iOS|iOS 横屏中添加UIImagePickerController获取系统图片
迁移自开源中国
- 在完全横屏的应用中(Supported interface orientations只有两个选项Landscape (right home button)和Landscape (left home button))。
- 添加UIImagePickerController来获取系统图片和拍照时崩溃
2014-03-25 10:11:37.697 beethoven-new iOS[1372:60b] *** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'
产生原因:UIImagePickerController默认只支持竖屏的原因
【iOS|iOS 横屏中添加UIImagePickerController获取系统图片】如何解决
添加UIImagePickerController分类LandScapeImagePicker
@interface UIImagePickerController (LandScapeImagePicker)- (BOOL)shouldAutorotate;
- (NSUInteger)supportedInterfaceOrientations;
@end
#import "UIImagePickerController+LandScapeImagePicker.h"@implementation UIImagePickerController (LandScapeImagePicker)- (BOOL)shouldAutorotate {
return YES;
}- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}@end
推荐阅读
- 热闹中的孤独
- Shell-Bash变量与运算符
- JS中的各种宽高度定义及其应用
- 2021-02-17|2021-02-17 小儿按摩膻中穴-舒缓咳嗽
- 深入理解Go之generate
- 异地恋中,逐渐适应一个人到底意味着什么()
- 我眼中的佛系经纪人
- 《魔法科高中的劣等生》第26卷(Invasion篇)发售
- “成长”读书社群招募
- 2020-04-07vue中Axios的封装和API接口的管理