アプリの画面が回転しなくなった時の解決方法

cocosd2dを2.0をバージョンアップしたら、画面が縦向きのままで回転をしなくなりましたのでその解決方法を書きたいと思います。

PROJECT TARGETSの方向を修正する

「Project」の「Targets」に入ります。 [Summary]にある「Supported Interface Orientations」で向きを設定します。

2013 2 12 d

これは以前にも、同じようなことがあったたので、今度は忘れないようにしよう。

Cocos2d側の変更

[AppDelegate.m]のなかで以下のコードを設定します。

[c] - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return UIInterfaceOrientationIsLandscape(interfaceOrientation); //横向き       // 縦の場合は UIInterfaceOrientationIsPortrait( interfaceOrientation )を設定する。 } [/c]

shouldAutorotateToInterfaceOrientation」は、cocos2d1.xではなかった設定だったので、最初手間取りました。 是非参考にしてください。

[参考サイト]