landscape orientation

Discussion in 'iOS Programming' started by mekopolis, Oct 22, 2008.

  1. mekopolis macrumors regular

    Joined:
    Feb 10, 2008
    #1
    quick question

    how do you set it so the view loads up in landscape orientation and stays in that mode?

    Code:
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    	// Return YES for supported orientations
    	return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
    }

    thanks
     
  2. fenrus110 macrumors regular

    Joined:
    Mar 24, 2008
    #2
    Code:
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    	// Return YES for supported orientations
    	// return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
    return YES;
    }
    
    You have to do more work than that though to make it really work properly. I'm having some difficulties with it. It gets nasty if you are using a UINavigationController in your program.
     
  3. mekopolis thread starter macrumors regular

    Joined:
    Feb 10, 2008
    #3
    i played around with it
    and this worked the best for me somehow

    hopes this helps someone

    Code:
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    	// Return YES for supported orientations
    	if( interfaceOrientation == UIInterfaceOrientationLandscapeRight ||
    	   interfaceOrientation == UIInterfaceOrientationLandscapeLeft ) {
    		return YES;
    	}
    	return NO;
    }
     
  4. fenrus110 macrumors regular

    Joined:
    Mar 24, 2008
    #4
    Here's a mind boggler. Let's say you have navigating through a table view in portrait mode, you when you go into the next screen, you want to look at the detail screen in landscape only.

    Can you do that?
     

Share This Page