I\'ve created a simple iPhone app which has two .xib files. In the app delegate at application did finish launching I display the first .xib file by calling:
When using a UIViewController the normal way (i.e. pushing it on a UINavigationController), it adjusts its view's frame.
Since you're adding the subview manually, you have to adjust the frame yourself. The origin is in the upper right corner (at the top of the status bar). You want to shift your view 20 pixels down.
Whenever a weird gap appears, or the view is partly hidden behind the status bar, it has something to do with either
i had both bugs in my app and solved them! Hope I could save you some time (I wasted a lot on it)
Looks like you call pushVC to this UIViewController
in the wrong place. I had the same problem. It was solved by moving [self.navigationController pushViewController: animated:]
from viewDidLoad
to viewDidAppear:
in a previous UIViewController
in hierarchy.
Here is my solution:
// adjust the frame of subview which is going to be add
self.navController.view.frame = CGRectMake(0, 0, 320, 460);
[self.view addSubView:self.navController.view];
It works fine for me now, good luck~ :)
In interface builder, you can add Simulated Interface Elements that will appear programatically (such as the status bar or the navigation bar). In your inspector, select your view, and go to the Attributes tab. Here you can simulate The Status bar, a top bar, or a bottom bar.