missModalViewControllerAnimated 将视图在原始视图中向上移动 20 像素
我在选项卡栏中的选项卡之一内有一个导航控制器。
在导航控制器中,我有根视图。
我正在呈现这样的模态视图:
[self presentModalViewController:modalViewController animated:YES];
但是,当我使用以下命令关闭视图时:
[self dismissModalViewControllerAnimated:YES];
.. 原始视图向上移动 20 像素,因此它位于状态栏下方。有办法防止这种情况吗?
I have a navigation controller within one of the tabs in a tab bar.
Within the nav controller I have the root view.
I am presenting a modal view like this:
[self presentModalViewController:modalViewController animated:YES];
However, when I dismiss the view with:
[self dismissModalViewControllerAnimated:YES];
.. the original view gets moved up 20 pixels, so it is under the status bar. Is there a way to prevent this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您使用选项卡栏,则应该从
UITabBarController
呈现您的视图,以便选项卡的内容保持不变:If you are using a tab bar, you should present your view from
UITabBarController
, so that your tab's content stays untouched:快速检查 - 模式视图的大小是否正确(即,如果在界面生成器中设置,那么它是否预留了右下栏和上栏空间)。如果不这样做,可能会发生奇怪的事情...与原始视图相同 - 如果上部导航栏和底部标签栏的笔尖尺寸不正确,那么它可能会出错...
Quick thing to check - is the size of the modal view correct (i.e. if set up in interface builder then does it have the right bottom and top bar space set aside). Odd things can happen if not... Ditto with the original view - if it's not the right size in the nib for both the upper navbar and the bottom tabbar then it might go wrong...
为了更好的开发,您应该添加模态视图的大小。使用 CGRect 或编辑 xib 文件的视图。它可能会起作用...:)
for the better development, you should add the size of your modal view. Use CGRect or edit your view on xib file. It may work... :)