选择视图支持的方向:
1、应用级(全局)设置:
项目 general配置->Deployment info->Device Orientation.
有4种方向可选:portrait 竖直
uoside down 倒立
landscape right 右横屏
landscape left 左横屏
iphone 默认不支持uoside down,ipad 默认全支持
以上的设置都可以在Info.plist文件中进行编辑
2、视图级设置
视图级支持的方向只能是应用级支持方向的子集
在view controller的实现文件里要实现UIViewController中的一个方法来指定当前视图支持的方向
-(NSUInteger)supportedInterfaceOrientations {
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft);
}
实现了可支持竖直和左横屏。