How to remedy a UINavigationBar overlapping the top of my UIScrollView?
I am working with a TabBarController >> NavBarController UI. One of my UIViewControllers has a UIS开发者_C百科crollView 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.
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.
精彩评论