views:

41

answers:

1

Hi all! How can I made my app to allow only the landscape orientation but both (left and right)? so if I rotate 180° the app will be rotate but if I rotate in portrait the app doesn't rotate?

thanks

+1  A: 

Try adding this to your UIViewController:

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
            interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

You can learn more about this here: UIViewController class reference

Jamie Chapman
thanks jamie! I'll try!
ghiboz