雛形作成直後横向き起動前提でソースコード生成されるがタテ起動のみとする修正。よく忘れるのでメモ。。
iOSへの対応
xCodeプロジェクト
General > Deployment Info > Devices
iPhoneを選択
General > Deployment Info > Device Orientation
Portrait のみつける
RootViewController.mm の修正
1カ所目
1 2 3 4 |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return UIInterfaceOrientationIsLandscape( interfaceOrientation ); } |
↓
1 2 3 4 5 |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { //return UIInterfaceOrientationIsLandscape( interfaceOrientation ); return UIInterfaceOrientationIsPortrait( interfaceOrientation ); } |
2カ所目
1 2 3 4 5 6 |
- (NSUInteger) supportedInterfaceOrientations{ #ifdef __IPHONE_6_0 return UIInterfaceOrientationMaskAllButUpsideDown; #endif } |
↓
1 2 3 4 5 6 7 |
- (NSUInteger) supportedInterfaceOrientations{ #ifdef __IPHONE_6_0 //return UIInterfaceOrientationMaskAllButUpsideDown; return UIInterfaceOrientationMaskPortrait; #endif } |
Androidの対応
AndroidManifest.xml の修正
テキストエディタで開いて修正
1 2 |
android:screenOrientation="landscape" |
↓
1 2 |
android:screenOrientation="portrait" |
(参考)公式:Device Orientation
http://www.cocos2d-x.org/wiki/Device_Orientation