UISplitViewController 在菜单弹出框可见的情况下旋转时会缩小左侧
我以前从未见过这种情况发生,我不知道是什么原因造成的,也许你可以提供帮助。我有一个 UISplitViewController 作为我的根视图控制器。左侧是带有表视图控制器的 UINavigationController。我可以一遍又一遍地从肖像旋转到风景,然后再返回,没有任何问题。但是,如果我处于纵向模式,并且点击“菜单”按钮以显示包含左侧导航控制器的 UIPopoverController,并在菜单可见时旋转到横向,则带有导航控制器的左侧视图会变得更薄!左侧变薄约 30 像素,并且左侧和详细视图控制器之间出现间隙。
我惊呆了。有什么想法吗?
编辑:弹出菜单在旋转过程中不需要可见。只需要在纵向显示时就会发生尺寸问题。我没有任何代码可以更改 UISplitViewController 委托方法中任何内容的大小。我仅更新详细视图控制器中的工具栏以添加/删除菜单栏按钮项。我已经记录了左侧控制器在旋转之前/之后/期间以及在弹出窗口中显示之前/之后/期间的帧大小,并且它始终显示为 320 宽。
肯尼
I've never seen this happen before and I can't figure out what is causing it, maybe you can help. I have a UISplitViewController as my root view controller. The left side is a UINavigationController with a table view controller. I can rotate from potrait to landscape and back again over and over without any problems. However, if I'm in portrait and I tap the Menu button to show the UIPopoverController containing the left side nav controller and rotate to landscape while the menu is visible the left view with the nav controller gets thinner! The left side gets about 30 pixels thinner and a gap shows up between the left side and the detail view controller.
I'm flabberghasted. Any ideas?
EDIT: The popover menu doesn't need to be visible during the rotation. It only needs to have been shown while in portrait for the sizing issue to happen. I don't have any code that changes the size of anything in my UISplitViewController delegate methods. I only update the toolbar in the detail view controller to add/remove the Menu bar button item. I've logged the frame size of the left-side controller before/after/during rotation and before/after/during showing in the popover and it is always showing as 320 wide.
Kenny
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了解决方案。我右侧的详细视图控制器有一个 UIImageView,其中包含背景图像。背景图像对于纵向方向来说足够大,因此它比 UIImageView 调整为横向视图大小时更大。它的内容模式设置为中心。由于某种原因,这是左侧视图尺寸减小的原因(即使左侧框架在任何时候都没有改变)。检查我的详细视图控制器的 xib 中的“剪辑子视图”复选框似乎已经解决了问题。
I found a solution. My detail view controller on the right side had a UIImageView which contained a background image. The background image was large enough for the portrait orientation, so it is larger than the UIImageView is when it has been resized for landscape view. It's Content Mode was set to Center. For some reason that is the cause of the size reduction of the left side view (even though the left side frame never changed at any point). Checking the "Clip Subviews" checkbox in the xib for my detail view controller seems to have solved the problem.