quick-cocos2d 设置横屏

quick cocos2d新建项目,在xcode中 起模拟器,默认的是竖屏,我想作一个横屏的游戏,前面已经说了ios

 

选中你的项目,在General这个标签内,Deoployment info的这个分组,有一个Device Orientation 标签,内有一个Portrait的选项,选中是竖屏,取消选中是横屏c++

 

这里的横屏竖屏只是你显示的状态,而并不是是你摆放游戏资源或者写代码按照坐标排布的横屏,这时候要设置Landscape Right,可是选中之后,就会直接崩溃xcode

 

int main(int argc, char *argv[]) {app

    NSAutoreleasePool *pool = [NSAutoreleasePool new];ui

    int retVal = UIApplicationMain(argc, argv, nil, @"AppController");//会崩溃在这一句 spa

    [pool release];code

    return retVal;游戏

 

 

Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [RootViewController shouldAutorotate] is returning YES'资源

libc++abi.dylib: terminating with uncaught exception of type NSExceptionit

这里的缘由也已经讲清楚了,是你的初始化不支持横屏,咱们须要作一个修改

 

在RootViewController.mm  中

 

// For ios6.0 and higher, use supportedInterfaceOrientations & shouldAutorotate instead

- (NSUInteger) supportedInterfaceOrientations

{

//加上这一句,而后试一下,一切 ok     

return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;

#ifdef __IPHONE_6_0

    return UIInterfaceOrientationMaskPortrait;

#endif

}

相关文章
相关标签/搜索