PDA

View Full Version : Auto-rotating intro-screen not working [ipad]




Danneman101
Aug 6, 2010, 03:56 PM
Ive got an intro-view that appears right after the splash-screen, and that is loaded from the didFinishLaunchingWithOptions in the AppDelegate.m-file.

Problem is it wont rotate when the device rotates. This despite the fact that the splash-screen rotates fine to the selected orientation, and that the info-file supports all 4 rotations.


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[window addSubview:splitViewController.view];
[window makeKeyAndVisible];

// Create intro-screen, with some nick-nacks not included here
CGSize screenSize = [UIScreen mainScreen].bounds.size;
CGRect screenBounds = CGRectMake(0, 0, screenSize.width, screenSize.height);
introView = [[UIView alloc] initWithFrame:screenBounds];
[window addSubview:introView];

return YES;
}


Any idea as to what might be causing it?



PhoneyDeveloper
Aug 6, 2010, 05:38 PM
There's a reason that apple invented view controllers. Make your view and view controller part of the view controller hierarchy and it should work.

Danneman101
Aug 8, 2010, 06:11 AM
I see - only a viewcontroller can handle auto-rotation of views, whereas auto-rotating the default.png is a totally separate issue.

In my case, having a splitviewcontroller-app, the solution was simply to utilize that viewcontroller instead of making a new one. So, instead of adding the view to the window, I added it to the splitviewcontroller as such:


[splitViewController.view addSubview:introView];


Thanks for the input.

PhoneyDeveloper
Aug 8, 2010, 12:29 PM
Very good. I don't really know why but a lot of developers think they can avoid view controllers.