UIVIewController wrong position before rotate

Posted by zegnus on Stack Overflow See other posts from Stack Overflow or by zegnus
Published on 2010-06-16T00:56:43Z Indexed on 2010/06/16 1:02 UTC
Read the original article Hit count: 323

I have the starter point of my application this window (white background):

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    mainScreen = [[MainScreenController alloc] initWithNibName:@"MainScreenController" bundle:[NSBundle mainBundle]];

    // add it to the main window
    [window  addSubview:[mainScreen view]];

    // show view
    [window makeKeyAndVisible];

    NSLog(@"started");

    return YES;
}

And MainScreenController is an UIViewController with (blackBackground) created by the Interface Builder.

The application executes perfectly but the first time, the black view is moved up like the height of the status iphone pannel (leaving white rectangle at the bottom).

If I rotate the iPhone twice, the view is perfectly positioned in the right place, filling all the screen with the black background.

Any idea?

Thanks!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiview