如何在纵向模式下仅限制一个屏幕,在ipad中限制横向设置中的其他屏幕

时间:2014-07-22 11:16:14

标签: ipad ios7

我的应用仅在横向模式下运行,但我想在UIImagePicker中以纵向模式查看一个视图。

我在viewController中编写以下内容

 (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        return UIInterfaceOrientationIsPortrait(interfaceOrientation);
    } else {
        return (interfaceOrientation = UIInterfaceOrientationPortraitUpsideDown);
    }

}

// iOS6
 (BOOL)shouldAutorotate {
    return YES;
}

// iOS6
 (NSUInteger)supportedInterfaceOrientations {

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {

        return  (UIInterfaceOrientationMaskLandscape);
//              return (UIUserInterfaceLayoutDirectionLeftToRight || UIUserInterfaceLayoutDirectionRightToLeft);

    } else {

        return UIInterfaceOrientationMaskPortrait;

    }

}

// Added after comment
 (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        return UIInterfaceOrientationLandscapeLeft;
    } else {
        return UIInterfaceOrientationPortrait;
    }

}

在DriverAddPage.m上我写了

 (BOOL)shouldAutorotate {
    return YES;
}

// iOS6
 (NSUInteger)supportedInterfaceOrientations {

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {

        return  (UIInterfaceOrientationMaskPortrait);


    } else {

        return UIInterfaceOrientationMaskPortrait;

    }

}

我做错了什么?帮助我。

提前谢谢。

0 个答案:

没有答案