iPad 布局仅在发布时有所不同
好吧,我正在开发的 iPad 应用程序有一个有趣的问题。
当应用程序以纵向模式启动时,布局将按预期工作。我旋转 iPad,旋转效果很好。
当应用程序以横向模式启动时,会出现额外的空白,并且布局无法按预期工作。但是当我将应用程序旋转为纵向时,它旋转得很好。当我将其旋转回横向时,它的布局也很好。
什么可能导致这个问题?有问题的视图控制器是包含 UINavigationController 的视图控制器(我必须添加标头)。我想知道这是否与 UINavigationController 有关。
Ok I have an interesting issue on an iPad application I am developing.
When the app launches in portrait mode the layout works as expected. I rotate the iPad and the rotation works fine.
When the application launches in landscape mode there is additional white space appearing and the layout does not work as expected. But when I rotate the application to portrait it rotates just fine. It also lays out fine when I rotate it back to landscape.
What could be causing this problem? The view controller in question is a view controller that contains a UINavigationController (I had to add in a header). I wonder if it is something with UINavigationController.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的视图在启动时需要纵向模式。在你的视图控制器中,你需要让它知道寻找方向,并加载相应的视图。
Your view is expecting Portrait mode upon launch. In your view Controller, you need to let it know to look for orientation, and load the corresponding view.
好吧,我的应用程序中奇怪的是,当选项卡控制器将选项卡切换回时髦的视图时,布局会变得正确。因此,我添加了一个 hack,以便在主窗口的 makeKeyAndVisible 之前的选项卡之间进行切换。
我确实尝试过你的建议 WrightsCS。它不起作用的真正原因是因为我在页面的子视图中加载 UINavigationController 的视图,所以我无法真正控制混乱的布局。导航控制器顶部栏的加载速度比应有的要低一些。
Ok so what was strange in my application is that the layout would become correct when the tab controller switched tabs back to the view that was being funky. So, I added a hack in order to switch between the tabs before the makeKeyAndVisible of the main window.
I did try your suggestion WrightsCS. The real reason it didn't work is because I'm loading UINavigationController's view in the sub view of the page, so I didn't really have control of the layout that was messing up. The top bar of the navigation controller was loading a little lower than it should have been.