ios 6旋转后的模态视图大小不正确
问题描述:
我们有一个ipad应用程序,支持landsace的左右方向。ios 6旋转后的模态视图大小不正确
- (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的(全屏) - > SelectOption(500,500)的旋转工作正常,并选择相应的选项视图控制器具有原始大小。
当我们显示额外的模式视图:RootViewController(FullScreen) - > SelectOption(500,500) - >其他选项(300,300),旋转后SelectOption视图控制器大小改变为全屏,而AdditionalOptions视图控制器保持它的尺寸如指定。
答
问题是用小把戏解决的。
他们的问题根源在于,我打开第一个模式视图为PageSheet,当我打开第一个模式视图时,我得到了MainView(FullScreen),作为页面打开的模式视图,以及第二页表单从前一页打开。这种架构引起了旋转问题。
诀窍:现在我打开第二个模态视图为FormSheet,重新计算坐标以对应PageSheet坐标系。所以现在看起来像这个MainView-> PageSheet-> FormSheet和问题已修复。
对不起,没有代码。
你可以找到在http://*.com/questions/12554204/ios-6-rotation-issue-no-rotation-from-presented-modal-view-controller – freytag
的答案,我问在这里回答同样的问题:http://*.com/a/14989999/1742521希望它有帮助。 –
感谢您的链接,但这不是同一个问题。模态视图的方向会根据情况进行更改,但如果模态视图的父级具有相同的演示样式,则会变为全屏 –