UIViewController をつかって、自動回転してみた。

まだ、サンプルプログラムなんですけど、UIView を、UIViewController 経由で使うようにして、自動回転するようにしてみました。


↓この辺を参考にしました。
http://d.hatena.ne.jp/ntaku/20090206/1233929859
http://developer.apple.com/jp/iphone/library/featuredarticles/ViewControllerPGforiPhoneOS/AutorotatingViews/chapter_11_section_1.html



ちなみに、下記で、無条件にYESを返すと、どの方向に向けても、回転するようになりますね。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
   // return (interfaceOrientation == UIInterfaceOrientationPortrait);
	return YES;
}