如何修复UINavigationBar重叠我的UIScrollView顶部? [英] How to remedy a UINavigationBar overlapping the top of my UIScrollView?
问题描述
我正在使用TabBarController >> NavBarController UI。我的一个UIViewControllers中有一个UIScrollView,里面有一些文本(UITextField)。问题是,UIScrollView中最上面的文本被NavBar覆盖。我该如何解决?我试图在IB中手动调整混合结果的东西,但我想要更多的解决方案。
I am working with a TabBarController >> NavBarController UI. One of my UIViewControllers has a UIScrollView in it with some text (UITextField) in it. Problem is, the uppermost text in the UIScrollView is covered by the NavBar. How do I fix this? I am trying to manually adjust stuff in IB with mixed results but I want a more CERTAIN solution.
推荐答案
问题是你的视图太大了,它被定位在导航栏下。
The problem is that your view is too big, and it's being positioned under the nav bar.
要修复,请打开包含容器视图的.xib和/或 Interface Builder中的UIScrollView
,并打开属性检查器(Cmd-1)。
To fix, open up the .xib with your container view and/or your UIScrollView
in Interface Builder, and Bring up the Attributes Inspector (Cmd-1).
然后执行以下操作之一:
Then do one of the following:
- 确保将模拟用户界面元素(状态栏,顶栏和底栏)设置为适当的值(这将自动调整子视图帧)
或
- 将所有模拟用户界面元素设置为无,然后将容器视图调整为适当大小(如320x400),将自动调整大小设置为双向扩展。 (我更喜欢这种方法,这也是Xcode自动生成的基于导航栏的项目的默认方法)
然后你需要确保您已将该选项卡的根视图控制器设置为从NIB调整视图。如果您已在Interface Builder中实例化了一个 UINavigationController
实例(例如,在您的MainWindow.xib中),则可以在此处设置复选框。
Then you need to make sure that you've set the root view controller for that tab to "Resize View from NIB". If you've instantiated a UINavigationController
instance in Interface Builder (say, in your MainWindow.xib), you can set the checkbox there.
这篇关于如何修复UINavigationBar重叠我的UIScrollView顶部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!