【发布时间】:2010-06-08 14:39:02
【问题描述】:
我怎样才能让我的应用程序只允许横向,但同时(左和右)? 所以如果我旋转 180°,应用会旋转,但如果我纵向旋转,应用不会旋转?
谢谢
【问题讨论】:
标签: iphone landscape screen-orientation
我怎样才能让我的应用程序只允许横向,但同时(左和右)? 所以如果我旋转 180°,应用会旋转,但如果我纵向旋转,应用不会旋转?
谢谢
【问题讨论】:
标签: iphone landscape screen-orientation
尝试将其添加到您的 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
【讨论】: