Double status bar when showing modal view controller
I have a modal view, which I show after application launch. The problem now is that the Modal view leaves 20 pixels for the status bar (See pictur开发者_如何学Pythone)
double status bar http://k.minus.com/j1vKSpCmFJXie.png
This is what my MyViewController
looks like in Interface builder:
IB-Layout http://k.minus.com/jbyZPICtsq0sMy.png
In the viewDidLoad
callback I set the view to my WelcomeVC's view like this:
- (void)viewDidLoad{
[super viewDidLoad];
self.view = self.navController.view; // navController is the outlet to my NavigationController in IB
}
I open the modal like this:
MyViewController *welcomeVC = [[MyViewController alloc]init];
[self presentModalViewController:welcomeVC animated:YES];
[welcomeVC release];
How do I get rid of this space between the view and the status bar?
I'm not sure if I understood your question correctly.
Are you calling your modal view from within your navController?
If so, the problem could be that a child viewController is calling the modal, while the parent should, meaning the rootViewController, who is hosting your navController -- not the navController itself.
If you navController is calling the modal view -- just an opinion - why do you need to call a modalView? push it as a view into the stack, that is more compatible with UINavigationController environment.
I figured out that it does not make a lot of sense to add the NavigationController directly to the viewcontroller, since the NavigationController should rather be defined outside the ViewController, since my ViewController does not neccesarily know whether it will be displayed inside a NavigationController or a modal popup or maybe even a Popover on an iPad.
So what I've done is I created two separate ViewControllers for both the Welcome view
and the Plans view
. This means that they are more universally usable also for cases when only either of the views is displayed.
精彩评论