UINavigationController 布局在呈现模态后损坏

发布于 2024-12-21 01:39:09 字数 499 浏览 2 评论 0原文

从 iOS5 开始,我遇到了一个问题,当我呈现然后关闭模式视图时,我的导航控制器栏隐藏在状态栏下方。我已阅读论坛并尝试了很多方法,但找不到解决此问题的方法。

另外,我在呈现任何模式视图控制器时都会出现此行为,因此它似乎并不特定于我所呈现的视图控制器。起初我以为这是 ZXing 的问题,但这似乎是 iOS5 更新的普遍问题。

此外,如果我在关闭模式后选择 UITextField 并且我的导航栏隐藏在状态栏下方,则键盘会在窗口中出现错误的位置。同样,如果我来回旋转,导航控制器栏和键盘就可以正常工作。

任何想法将不胜感激。

已解决 好的。我终于发现问题在这里了。同样,这仅出现在 iOS5 中,但当我的 RootViewController 启动时,它会暂停旋转,直到动画完成。一旦完成,它就允许再次旋转。问题是它在所有方面(包括肖像)都返回“否”。视图显示得很好,但是当我呈现模态并返回时,视图几何形状被破坏了。一旦我将其更改为即使在动画期间也为纵向模式返回 YES,问题就消失了。

Ever since iOS5, I have a problem where when I present and then dismiss a modal view, my Navigation Controller bar is hidden underneath the status bar. I have read the forums and tried many things but I cannot find the fix for this behavior.

Also, I get this behavior when presenting any modal view controller so it does not appear to be specific to the view controller I am presenting. At first I thought it was a problem with ZXing but this seems to be generic with the iOS5 update.

Additionally, if I select a UITextField after dismissing the modal and my navigation bar is hidden under the status bar, the keyboard comes up misplaced in my window. Again, if I do a rotate back and forth, the navigation controller bar and the keyboard work just fine.

Any ideas would be appreciated.

RESOLVED
OK. I finally found the problem here. Again this only appeared in iOS5 but when my RootViewController launches it holds off on rotations until the animation is done. Once it is done, then it allows rotations again. The problem was that it was returning NO for all aspects (including portrait). The view showed fine but when I would present a modal and return, the view geometry was mangled. Once I changed it to return YES for portrait mode even during animation, the problem went away.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

刘备忘录 2024-12-28 01:39:09

解决了。我终于发现问题在这里了。同样,这仅出现在 iOS5 中,但当我的 RootViewController 启动时,它会暂停旋转,直到动画完成。一旦完成,它就允许再次旋转。问题是它在所有方面(包括肖像)都返回“否”。视图显示得很好,但是当我呈现模态并返回时,视图几何形状被破坏了。一旦我将其更改为即使在动画期间也为纵向模式返回 YES,问题就消失了。

RESOLVED OK. I finally found the problem here. Again this only appeared in iOS5 but when my RootViewController launches it holds off on rotations until the animation is done. Once it is done, then it allows rotations again. The problem was that it was returning NO for all aspects (including portrait). The view showed fine but when I would present a modal and return, the view geometry was mangled. Once I changed it to return YES for portrait mode even during animation, the problem went away.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文