views:

69

answers:

2

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:(NSDictionary *)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?

+1  A: 

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.

Jesse Naugher
+1  A: 

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?

iWasRobbed
my status bar is not hiding. its set in my plist, and also simulated in all my nibs. setting the frame is working. but why do i have to do that? my nibs have exact pixels and my status bar is showing?
choise
Honestly, I've only seen this happen when you are showing the status bar AFTER you add the view. Are you sure the status bar is shown in Interface Builder for the `MainWindow.xib` file too? If it's a window based app, that file's window is most likely linked to your app delegate which loads that other view you are trying to load. So everything gets set from whatever it looks like. (MainWindow is a default file that gets included in most templates of XCode)
iWasRobbed
yeah, thats strange, because its set in my "mainwindow.xib" and in my `app.plist`.
choise