问题描述
|
如何在横向模式下启动我的应用程序,并保持屏幕旋转呢?
解决方法
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
, 实现视图控制器的shouldAutorotateToInterfaceOrientation:
方法和return UIInterfaceOrientationIsLandscape(orientation);
还要将Info.plist
键UIInterfaceOrientation
和UISupportedInterfaceOrientations
设置为UIInterfaceOrientationLandscapeLeft
和UIInterfaceOrientationLandscapeRight
。 UIInterfaceOrientation
将采用一个值,因此分配其中一个并将它们都分配给UISupportedInterfaceOrientations
。