在生成的RootViewController.m文件里- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation方法中
#elif GAME_AUTOROTATION == kGameAutorotationUIViewController
//
// EAGLView will be rotated by the UIViewController
//
// Sample: Autorotate only in landscpe mode
//
// return YES for the supported orientations
return ( UIInterfaceOrientationIsPortrait( interfaceOrientation ) );
#else
return这行代码修改成这样就可以了
在新版的2.1版本的cocos2d里面,则需要在AppDelegate.m类里面把如下方法修改成这样:
// Supported orientations: Landscape. Customize it for your own needs
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
本文介绍了如何在Cocos2d 2.1版本中设置界面旋转方式,通过修改AppDelegate.m文件中的shouldAutorotateToInterfaceOrientation方法实现不同方向的界面显示。
350

被折叠的 条评论
为什么被折叠?



