【发布时间】:2013-10-31 11:34:56
【问题描述】:
我的应用程序仅在横向模式下运行!所以我知道UIImagePickerController 仅以纵向模式呈现,所以在 iOS 6 中,我创建了 UIImagePickerController 的子类,强制 UIImagePickerController 以纵向模式打开:
@interface NonRotatingUIImagePickerController : UIImagePickerController
@end
@implementation NonRotatingUIImagePickerController
- (BOOL)shouldAutorotate {
return NO;
}
@end
//presenting picker controller :
UIImagePickerController *ipc = [[NonRotatingUIImagePickerController alloc]init];
ipc.delegate = self;
[self presentViewController:ipc animated:YES completion:nil];
这在 iOS 6 中运行良好,但现在在 iOS 7 中,我的应用确实因此而崩溃:
2013-10-31 14:56:01.028 Medad[1731:60b] *** Terminating app due to
uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason:
'Supported orientations has no common orientation with the
application, and shouldAutorotate is returning YES'
如果我在部署信息中检查Portrait,这个问题可以解决:
问题是,如果我选中此选项,我的应用程序也会纵向运行,但我不想要它!
我该如何解决这个问题?
【问题讨论】:
-
@Mc.Lover - 你试过我的解决方案了吗?
-
我通过示例添加了一个可行的解决方案
标签: ios iphone objective-c xcode ipad