1、在完全横屏的应用中(Supported interface orientations只有两个选项Landscape (right home button)和Landscape (left home button))。
2、添加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默认只支持竖屏的原因。
解决:
添加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 |
在对应位置应用就可以了
本文解决了一个在完全横屏应用中使用UIImagePickerController获取系统图片和拍照时出现的崩溃问题。通过自定义UIImagePickerController分类LandScapeImagePicker,解决了应用在不同横屏方向上的适配问题。
848

被折叠的 条评论
为什么被折叠?



