如何使我的应用仅允许横向显示,但两者(左和右)? 因此,如果我旋转180°,应用程序将旋转,但如果我以纵向旋转应用程序不旋转?
谢谢
答案 0 :(得分:1)
尝试将此添加到您的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);
}
您可以在此处了解详情:UIViewController class reference