PDA

View Full Version : Autorotation Problem




wlh99
Aug 22, 2009, 01:40 PM
I am writing an app that runs in LandscapeRight. I want a spash screen to show briefly, then have the main view load.

I have the following:


- (void)applicationDidFinishLaunching:(UIApplication *)application {

// Override point for customization after app launch

[window addSubview:splashScreen.view];
[window makeKeyAndVisible];

}

-(void)begin
{
NSLog(@"App Delegate Begin");
[window resignKeyWindow];
[splashScreen.view removeFromSuperview];
[window addSubview:viewController.view];
[window makeKeyAndVisible];
}


// Overriden in both view controllers

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations

NSLog(@"%d",interfaceOrientation);
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);


}





The problem is that the main view (viewController.view) is all screwed up. But if I get rid of the spash screen an add the view in applicationDidFinishLaunching it displays fine. I don't understand why there is a difference, as the orientation doesn't change. I also have UIInterfaceOrientationLandscapeRight set in Info.plist, but that didn't seem to matter.