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;
    }

     

  • 相关阅读:
    @media screen针对不同移动设备-响应式设计
    闭包的一些例子
    es6 新关键字const
    es6 新关键字let
    Unity 多屏(分屏)显示,Muti_Display
    小米手机常用操作
    Charles使用笔记
    AKKA学习笔记
    Gatling-Session
    Scala学习笔记-6-其他
  • 原文地址:https://www.cnblogs.com/leevaboo/p/2919099.html
Copyright © 2011-2022 走看看