为什么 [UIViewController PresentModalViewController:animated:] 从左侧过渡模态视图?
我正在构建一个仅支持 iOS 4.3 下 iPad 上横向方向的应用程序,尽管该错误也存在于 iOS 4.2 下。
在应用程序的几个地方,我将 UIViewController 显示为模式视图。所有这些都使用这种模式显示:
viewController.modalPresentationStyle = UIModalPresentationFormSheet;
viewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:viewController animated:YES];
在大多数地方,它们按预期工作 - 模式表单从屏幕底部向上滑入。
但是,在两种情况下,模态表单会从屏幕左下角滑入。表单几乎一直滑到右侧,表单底部看不见。如果您聚焦文本字段并显示屏幕键盘,表单将移动到屏幕顶部中央您期望的位置。
我不认为 XIB 的模拟指标会影响它们的行为,但我已经为它们设置了方向(调用 UIViewController
self
和模态视图控制器) viewController
) 到 Landscape。
有什么想法为什么这两个模态表单的行为与其他表单不同?
I'm building an application that supports only Landscape orientation on the iPad under iOS 4.3, though the bug was present under iOS 4.2 as well.
Several places in the application, I am showing UIViewController
s as modal views. All of them are shown using this pattern:
viewController.modalPresentationStyle = UIModalPresentationFormSheet;
viewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:viewController animated:YES];
In most places, they work as expected - the modal form sheet slides in from the bottom of the screen upward.
However, in two cases, the modal form sheet slides in from the bottom left of the screen. The form sheet slides nearly all the way to the right with the bottom of the form sheet out of view. If you focus a text field and show the onscreen keyboard, the form sheet moves to the top center of the screen where you would expect it to be.
I don't think the Simulated Metrics of the XIBs affect their behaviour, but I have set the orientation for all of them (both the calling UIViewController
self
and the modal view controller viewController
) to Landscape.
Any ideas why these two modal form sheets are behaving differently from the others?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为在这里你不会在 shouldAutorotate 函数中返回横向方向,所以如果你想以左/右横向查看,请使用此代码:
尝试这个它可能会帮助你..
I think here you dint return landscape orientation in shouldAutorotate function so use this code if you wan view as landscape left/right:
Try this it may help you..
确保您在 NavigationController 中嵌入了 viewController,并且 navController shouldAutotorate 也设置为横向
Make sure if you have a viewController embedded in a NavigationController that the navController shouldAutotorate is also set to landscape