ios 6旋转后模态视图尺寸不正确 [英] ios 6 Incorrect modal view size after rotation

查看:149
本文介绍了ios 6旋转后模态视图尺寸不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

We have an ipad application, that supports landsace right and left orientation.

- (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)旋转工作正常并选择选项视图控制器具有原始大小。

When we are showing one modal view: RootViewController(FullScreen)->SelectOption(500, 500) rotation works fine and select options view controller has it's original size.

当我们显示其他模态视图时:RootViewController(FullScreen) - > SelectOption(500,500) - >其他选项(300,300),旋转后SelectOption视图控制器大小更改为全屏,而AdditionalOptions视图控制器保持其指定的大小。

When we are showing additional modal view: RootViewController(FullScreen)->SelectOption(500, 500)->Additional options(300, 300), after rotation SelectOption view controller size changed to full screen while AdditionalOptions view controller keeps it's size as was specified.

推荐答案

这个问题通过小技巧解决了。

The problem was solved with small trick.

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

The root of them problem, was that i'm opening first modal view as PageSheet, when i'm opening second modal view from first one i got MainView(FullScreen), modal view opened as page sheet, and second page sheet opened from previous page sheet. This architecture caused problems with rotation.

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

Trick: now i'm opening second modal view as FormSheet with recalculating coordinates to correspond PageSheet coordinate system. So now it looks like this MainView->PageSheet->FormSheet and the problem was fixed.

很抱歉没有代码。

这篇关于ios 6旋转后模态视图尺寸不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆