使应用程序启动并保持横向模式

问题描述

| 如何在横向模式下启动我的应用程序,并保持屏幕旋转呢?     

解决方法

        
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || 
   interfaceOrientation == UIInterfaceOrientationLandscapeRight);
} 
    ,        实现视图控制器的
shouldAutorotateToInterfaceOrientation:
方法和
return  UIInterfaceOrientationIsLandscape(orientation);
还要将
Info.plist
UIInterfaceOrientation
UISupportedInterfaceOrientations
设置为
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
UIInterfaceOrientation
将采用一个值,因此分配其中一个并将它们都分配给
UISupportedInterfaceOrientations
。