iPad横屏调用相册,出现闪退

来源:互联网 发布:mfc串口编程实例 编辑:程序博客网 时间:2024/05/01 11:13

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

}

#endif

在该viewController和上一层的viewController中添加 

#pragma mark - Orientation

#pragma mark ios6以下

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation

{

    return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);

}


#pragma mark ios6是否支持转屏

-(BOOL)shouldAutorotate

{

    return YES;

}


#pragma mark  支持的方向

-(NSUInteger)supportedInterfaceOrientations

{

    return UIInterfaceOrientationMaskLandscape;

}


#pragma mark 默认支持的朝向

-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation

{

    return UIInterfaceOrientationLandscapeRight;

}


第二种方法:

写一个类继承UIImagePickerController 在里面添加支持横屏的方法,也可以解决。




原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 淘宝别人举报我盗用图片怎么办 淘宝卖家被投诉盗图怎么办 淘宝卖家被投诉卖假货怎么办 淘宝买到假货卖家不承认怎么办 被投诉盗图扣2分怎么办 拼多多盗淘宝图怎么办 微信视频清理了怎么办 牛仔短裤买大了怎么办 淘宝图片打开变大了怎么办 同城换公司社保怎么办 劳务不给交社保怎么办 好多工厂外包工不交社保怎么办 外包公司没有交社保怎么办 外包公司不给交社保怎么办 银行取100万现金怎么办 给老外发警告信后怎么办 照片上传是歪的怎么办 日亚不能直邮的怎么办 电话信息被卖了怎么办 被亚马逊跟卖了怎么办 玉米出芽后土壤不够湿怎么办 雨伞请输入授权码怎么办 网页放手机端后看不了怎么办 微信收款码存在违法行为怎么办 tst优惠码密码忘了怎么办 扩展器登录不上怎么办 微信学法小程序积分不更新怎么办 开发商不给办房产证怎么办 传淘宝产品规格不匹配怎么办 刚买的手机想退怎么办 空调主机空间不足不散热怎么办 lol网速快延迟高怎么办 4g手机延迟高怎么办 天气冷鼻炎就犯怎么办 天气冷宝宝发烧了怎么办 wp手机开机忘记了密码怎么办 微商退货不退款怎么办 微商退货了不退款怎么办 微商退货后不退款怎么办 有赞买东西付款没发货怎么办 赞礼号掉了东西怎么办