【问题标题】:iOS 6 Orientation with NavigationController带有 NavigationController 的 iOS 6 方向
【发布时间】:2012-11-28 11:40:38
【问题描述】:

我目前正在开发一个适用于 iOS 5 和 iOS 6 的应用程序。 我的大部分观点都只针对纵向,除了 1。

RotationNavigationController:覆盖supportedInterfaceOrientationshouldAutorotate 的主UINavigationController

PageViewController : 推送到 RotationNavigationController 中,仅纵向显示。

ImageViewController :在 PageViewController 之后推送。显示为UIInterfaceOrientationMaskAllButUpsideDown

这是我在ImageViewControllerViewDidLoad 中的内容

- (void)viewDidLoad
{
   // currentMask is the value returned by supportedInterfaceOrientation
   [(RotationNavigationController*)self.navigationController setCurrentMask:UIInterfaceOrientationMaskAllButUpsideDown];
   [(RotationNavigationController*)self.navigationController setShouldAutorotate:YES];
}

当我在横向模式下从 ImageViewController popViewController 时,我也会以横向模式返回 PageViewController,而 PageViewController 仅支持纵向。

当然,我将 ImageViewController 的 viewWillDisappear 中的蒙版重置为 Portrait。

有没有办法让 PageViewController 保持纵向?

【问题讨论】:

标签: ios uinavigationcontroller ios6 orientation


【解决方案1】:

感谢 emrys57 的链接。我在那里找到了解决方案,最后还是很简单的:

在 RotationNavigationController 中,只需添加以下方法:

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-16
    • 2012-09-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多