Ios UIImagePickerController和接口方向

Ios UIImagePickerController和接口方向,ios,objective-c,Ios,Objective C,我的应用程序是通用的。iPad仅为横向(左侧或右侧);iPhone只是一个肖像 按照编码,iPhone的一切都很正常,但我在iPad上尝试演示UIImagePickerController时遇到了以下错误 错误 这是我的设置 Info.plist(iPad支持的方向) 视图控制器显示选择器 } UIImagePickerController类别 值得注意 UIImagePickerController(在iPad中)是从UIPopoverController(在UIImagePickerCont

我的应用程序是通用的。iPad仅为横向(左侧或右侧);iPhone只是一个肖像

按照编码,iPhone的一切都很正常,但我在iPad上尝试演示UIImagePickerController时遇到了以下错误

错误 这是我的设置

Info.plist(iPad支持的方向) 视图控制器显示选择器 }

UIImagePickerController类别 值得注意
UIImagePickerController(在iPad中)是从UIPopoverController(在
UIImagePickerController
类别使用中)呈现的视图控制器呈现的

-(NSUInteger)supportedInterfaceOrientations {  
    if(isPad()){
        return UIInterfaceOrientationMaskLandscape;
    }
    else{
        return UIInterfaceOrientationMaskPortrait;
    }
} 

事实证明,您必须在iPad上的popover中显示UIImagePickerController。

UIImagePickerController类仅支持纵向模式。请参见

不应使用类别覆盖方法。仅当图像选择器不适用于相机时,才应如此。对于相机,图像选择器应显示在全屏模式视图控制器中。感谢您的澄清!
<array>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    if(isPad()){
        return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
    }else{
        return UIInterfaceOrientationMaskPortrait;
    }
}
- (NSUInteger) supportedInterfaceOrientations
{
    if(isPad()){
        return UIInterfaceOrientationMaskLandscape;
    }else{
        return UIInterfaceOrientationMaskPortrait;
    }
}

-(BOOL)shouldAutorotate{
    return NO;
}

-(UIInterfaceOrientation) preferredInterfaceOrientationForPresentation {
if(isPad()){
    return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
}else{
    return UIInterfaceOrientationPortrait;
}
- (NSUInteger) supportedInterfaceOrientations
{
    if(isPad()){
        return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
    }else{
        return UIInterfaceOrientationMaskPortrait;
    }
}

-(BOOL)shouldAutorotate{
    return NO;
}

-(UIInterfaceOrientation) preferredInterfaceOrientationForPresentation {
    if(isPad()){
        return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
    }else{
        return UIInterfaceOrientationPortrait;
    }
}
-(NSUInteger)supportedInterfaceOrientations {  
    if(isPad()){
        return UIInterfaceOrientationMaskLandscape;
    }
    else{
        return UIInterfaceOrientationMaskPortrait;
    }
}