UIView underneath Status Bar
Hi i have a strange issue after adding my UIViewController.view to my Application Window.
I created a window based app and added my view in my appDelegates didFinishLaunchingWithOptions
method.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSD开发者_开发问答ictionary *)launchOptions {
overviewViewController *overView = [[overviewViewController alloc] initWithNibName:@"overviewViewController" bundle:nil];
//overView.view.bounds = CGRectMake(0.0f, 20.0f, 320.0f, 460.0f);
[window addSubview:overView.view];
//[overView release];
[window makeKeyAndVisible];
return YES;
}
clicking the "add" button presents a model view controller. after dismissing this modelViewController the main view fits perfectly.
as you can see, i also tried to set the bounds before adding my subview, without any success.
does anybody have some hints for me please, how to solve this problem?
You can fix this by setting this in your viewDidLoad
method or even the viewWillAppear
:
self.view.frame = [[UIScreen mainScreen] applicationFrame];
Also, I'm guessing you are hiding your status bar initially? Or do you have it always showing?
in your nib, check to make sure the simulated interface status bar is turned on so that it shows up when your editing your nib's view.
if this does not work, try setting the frame instead of bounds before you add it to the window.
精彩评论