zoukankan      html  css  js  c++  java
  • quick-cocos2d 设置横屏

    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

    }

     

  • 相关阅读:
    iOS-Core-Animation-Advanced-Techniques(一)
    vue 路由
    Vue 生产环境部署
    vue 单文件组件
    vue 插件
    Vue 混合
    vue 自定义指令
    vue render函数 函数组件化
    vue render函数
    vue 过渡状态
  • 原文地址:https://www.cnblogs.com/fish124423/p/5893467.html
Copyright © 2011-2022 走看看