UIOrientation

Discussion in 'iOS Programming' started by jnoxx, May 24, 2011.

  1. macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #1
    Hai Guys!

    Having some issues..
    I have an app with a root controller, this is landscape only. I checked this all in the nibs, and edited the .plist, so it's landscape(left/right) only. and my method returns

    Code:
     // Override to allow orientations other than the default portrait orientation.
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    	// Return YES for supported orientations.
    	return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
    }
    So when I push my special controller onto the stack (it's a navigationcontroller). it also goes landscape, and that's possible going to portrait mode. but if i switch the second controller to portrait mode, and then go back to my root, this is also portrait mode. So it doesn't do a second check, and changes again.. Any idea how I would go on checking how to fix this?


    Gz, Noxx
     
  2. macrumors regular

    nickculbertson

    Joined:
    Nov 19, 2010
    Location:
    Nashville, TN
    #2
    Try this for your landscape view.

    Code:
    
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        return UIInterfaceOrientationIsLandscape(interfaceOrientation);
    }
    
    
     
  3. jnoxx, May 25, 2011
    Last edited by a moderator: May 25, 2011

    thread starter macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #3
    Tried all that, it's a headbreaker, since it's for only demo'ing, and not appstore material, i'm using this private method now..

    Code:
    [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeLeft];
    It's undocumented, but it works great ;/
    I'll have to figure it out later.
     

Share This Page