zoukankan      html  css  js  c++  java
  • ios6下cocos2d & ipad 调用摄像头报错问题 (在竖屏情况下调用Camera 会导致转屏)

      Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'
    因为UIImagePickerController是竖屏的,而ipad是横屏的,在ios6.0的横竖屏的问题比较敏感,所以在会挂的。
    解决办法:
    在supported Interface Orientations选中landscapeLeft和LandscapeRight(不选中的话在iOS5.0下第一次运行会竖屏)
    在appdelegate添加
    #if __IPAD_OS_VERSION_MAX_ALLOWED >= __IPAD_6_0

    - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
    {

    return UIInterfaceOrientationMaskAll;


    }
    #endif
    在该viewController和上一层的viewController中添加
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation


    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight );

    }

    -(NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskLandscape;
    }

    - (BOOL)shouldAutorotate
    {
    return YES;
    }

     

  • 相关阅读:
    uva11552
    zoj3820 树的直径+二分
    hdu 5068 线段树加+dp
    zoj3822
    uva1424
    DAY 36 前端学习
    DAY 35 前端学习
    DAY 34 PYTHON入门
    DAY 33 PYTHON入门
    DAY 32 PYTHON入门
  • 原文地址:https://www.cnblogs.com/leevaboo/p/2919099.html
Copyright © 2011-2022 走看看