3

我们有一个 ipad 应用程序,它支持横向左右方向。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Overriden to allow any orientation.
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

我们通过调用将视图控制器显示为模态视图

childController.modalPresentationStyle = UIModalPresentationPageSheet;
    childController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[parentController presentViewController:childController animated:childController.animated completion:^{
        childController->isBeingShowed = FALSE;

当我们显示一个模式视图时: RootViewController(FullScreen)->SelectOption(500, 500) 旋转工作正常并且选择选项视图控制器具有它的原始大小。

当我们显示附加模式视图时:RootViewController(FullScreen)->SelectOption(500, 500)->Additional options(300, 300),旋转后 SelectOption 视图控制器大小更改为全屏,而 AdditionalOptions 视图控制器保持指定的大小.

4

1 回答 1

1

小技巧解决了这个问题。

问题的根源在于,我将第一个模态视图作为 PageSheet 打开,当我从第一个模态视图打开第二个模态视图时,我得到了 MainView(FullScreen),模态视图作为页面表打开,第二个页面表从上一个打开页表。这种架构导致了旋转问题。

技巧:现在我将第二个模态视图作为 FormSheet 打开,并重新计算坐标以对应 PageSheet 坐标系。所以现在它看起来像这个 MainView->PageSheet->FormSheet 并且问题已解决。

对不起,没有代码。

于 2013-02-27T08:50:38.107 回答