How can I made my app to allow only the landscape orientati开发者_Go百科on 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
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
精彩评论