** IOS6になってrotateがおかしいメモ [#g56ac8f6]
> 今まではLeft固定で問題なく起動できていたのだけど、Xcode4.5でiPhone5やiPadで起動してみると本体は横向きなんだけど中身が縦表示になっている。IOS6で回転の仕組みが変更になったようです。具体的にはshouldAutorotateToInterfaceOrientationがDeprecatedで、supportedInterfaceOrientationsとshouldAutorotateが追加されています。

- before
 - (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation {
 	return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
 }
- after
 -(NSUInteger)supportedInterfaceOrientations{
 	return UIInterfaceOrientationMaskLandscapeLeft;
 }
 - (BOOL)shouldAutorotate{
 	return YES;
 }

> ついでに僕の環境だとこれだけだと解決できず、具体的にはshouldAutorotateもsupportedInterfaceOrientationsも呼ばれませんでしたが別の原因がありました。これは結構前の変更分みたいですね。今まで奇跡的に動いていた感じでした。こんなログ今まで出てたっけなぁ。
 Applications are expected to have a root view controller at the end of application launch

- before
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
 	[window addSubview:controller.view];
 	....
 	return YES;
 }
- after
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
 	[self.window setRootViewController:controller];
 	....
 	return YES;
 }

- [[iOS 6 UI Interface Orientation - shouldAutorotateToInterfaceOrientation: Not Working:http://dhilipsiva.blogspot.jp/2012/07/ios-6-ui-interface-orientation.html]] -- DhilipSiva
- [[applications expected to have a root view controller console:http://stackoverflow.com/questions/8190567/applications-expected-to-have-a-root-view-controller-console]] -- stackoverflow

----
#comment(nodate);

[ 編集 | 差分 | 添付 | 複製 | 名前変更 | リロード ]   [ 新規 | 一覧 | 単語検索 | 最終更新 | ヘルプ ]