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

问题描述

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

解决方法

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

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...