Supported orientations has no common orientation with the application, and shoul

阅读更多

在调用UIImagePickerController出现这个错误的解决办法:
Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'
在Info.plist里需要设置程序支持Portrait,同时编写一个继承类继承UIImagePickerController。

@interface NonRotatingUIImagePickerController : UIImagePickerController
@end

@implementation NonRotatingUIImagePickerController
- (BOOL) shouldAutorotate
{
    return YES;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return UIInterfaceOrientationIsLandscape( interfaceOrientation );
}
- (NSUInteger) supportedInterfaceOrientations{
#ifdef __IPHONE_6_0
    return UIInterfaceOrientationMaskAllButUpsideDown;
    //return UIInterfaceOrientationMaskLandscape;
#endif
}
@end

 
原因是UIImagePickerController默认是竖屏,所以程序需要支持竖屏,然后通过自定义的controller来支持具体的屏幕类型。

你可能感兴趣的:(Supported orientations has no common orientation with the application, and shoul)