Auto-rotating intro-screen not working [ipad]

Discussion in 'iPhone/iPad Programming' started by Danneman101, Aug 6, 2010.

  1. macrumors 6502

    Joined:
    Aug 14, 2008
    #1
    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.

    Code:
    - (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?
     
  2. macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    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.
     
  3. thread starter macrumors 6502

    Joined:
    Aug 14, 2008
    #3
    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:

    Code:
    [splitViewController.view addSubview:introView];
    
    Thanks for the input.
     
  4. macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #4
    Very good. I don't really know why but a lot of developers think they can avoid view controllers.
     

Share This Page