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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The problem is that your view is too big, and it's being positioned under the nav bar.
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:
- Make sure the Simulated User Interface Elements (for Status Bar, Top Bar, and BottomBar) are set to appropriate values (which will automatically adjust the subview frames)
or
- Set all Simulated User Interface Elements None, and then size your container view down to an appropriate size (like 320x400), set the autosizing to expand in both directions. (I prefer this method, and this is also the default method for a nav bar-based project that Xcode autogenerates)
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.