如何在横向模式下启动应用程序,并保持屏幕旋转?
答案 0 :(得分:5)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
答案 1 :(得分:1)
实施视图控制器的shouldAutorotateToInterfaceOrientation:
方法和return UIInterfaceOrientationIsLandscape(orientation);
同时将Info.plist
键UIInterfaceOrientation
和UISupportedInterfaceOrientations
设置为UIInterfaceOrientationLandscapeLeft
和UIInterfaceOrientationLandscapeRight
。 UIInterfaceOrientation
将采用单个值,因此请指定其中一个并将其分配给UISupportedInterfaceOrientations
。