quickcocos2dx xcode 6.3 中项目横屏设置

今天在捣鼓项目的时候发现,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
}

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

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值