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