启动应用并保持横向模式

时间:2011-06-15 04:38:37

标签: objective-c ios cocoa-touch landscape uiinterfaceorientation

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

2 个答案:

答案 0 :(得分:5)

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || 
   interfaceOrientation == UIInterfaceOrientationLandscapeRight);
} 

答案 1 :(得分:1)

实施视图控制器的shouldAutorotateToInterfaceOrientation:方法和return UIInterfaceOrientationIsLandscape(orientation);

同时将Info.plistUIInterfaceOrientationUISupportedInterfaceOrientations设置为UIInterfaceOrientationLandscapeLeftUIInterfaceOrientationLandscapeRightUIInterfaceOrientation将采用单个值,因此请指定其中一个并将其分配给UISupportedInterfaceOrientations