quickcocos2dx xcode 6.3 中项目横屏设置

来源:互联网 发布:颜色特征提取算法 编辑:程序博客网 时间:2024/04/29 13:00

今天在捣鼓项目的时候发现,xcode6.3版本中的横屏设置并不是在项目的
TARGET->General->Deployment Info->Device Orientation中进行勾选就完事了
必须修改代码
首先,以上的部分必须选择
Landscape Left
Landscape Right
这2个选项
若仅仅如此,直接编译通过。再运行,则会出现app crash的情况,而且输出以下提示
** Terminating app due to uncaught exception ‘UIApplicationInvalidInterfaceOrientation’,reseason:’Supported orientations has no common orientation with the application, and shouldAutoroate is returning YES’
然后输出一些traceback的东西
解决方法
在AppController.mm中编写以下接口

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{    if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){        return UIInterfaceOrientationMaskAll;    }else{        return UIInterfaceOrientationMaskAllButUpsideDown;    }}

OK,crash 的问题到此为止解决了

接下来编译运行,还是竖屏的,原因在于RootViewController.mm中所有的接口都是返回的竖屏,只要修改以后2个接口就OK

(BOOL) shouldAutoroateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{    // return UIInterfaceOrientationIsPortrait(interfaceOrientation);    return UIInterfaceOrientationIsLandscape(interOrientation);}-(NSUInteger)supportedInterfaceOrientations{#ifdef __IPHONE_6_0    // return UIInterfaceOrientationMaskPortrait;    return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft;#endif}

没有笔误的话,编译完成以后重启就会发现横屏了~~~

0 0
原创粉丝点击