首页 > 其他 > 详细

quick-cocos2d 设置横屏

时间:2016-09-21 17:28:45      阅读:143      评论:0      收藏:0      [点我收藏+]

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

 

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

 

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

 

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

    NSAutoreleasePool *pool = [NSAutoreleasePool new];

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

    [pool release];

    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 NSException

这里的原因也已经讲清楚了,是你的初始化不支持横屏,我们需要做一个修改

 

在RootViewController.mm  中

 

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

- (NSUInteger) supportedInterfaceOrientations

{

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

return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;

#ifdef __IPHONE_6_0

    return UIInterfaceOrientationMaskPortrait;

#endif

}

 

 

quick-cocos2d 设置横屏

原文:http://www.cnblogs.com/fish124423/p/5893467.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!