IOS6横屏时调用UIImagePickerController时会出现闪退:
*** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'
解决办法,在调用UIImagePickerController的类中加入下面代码:@interface UIImagePickerController (LandScapeImagePicker)
@end
@implementation UIImagePickerController (LandScapeImagePicker)
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
if ([self isKindOfClass:[UIImagePickerController class]]) {
return UIInterfaceOrientationPortrait;
}
return [self.topViewController preferredInterfaceOrientationForPresentation];
}
@end
本文解决iOS6系统中在横屏模式下使用UIImagePickerController时出现的闪退问题,通过在调用类中加入特定代码实现兼容性优化。

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



