要不用代码可以在Summary里进行设置,让设备不支持横竖屏
如图所示
如果要支持横竖屏,也可使用代码,但在ios6.0之后使用新的几个方法
// New Autorotation support.
- (BOOL)shouldAutorotate NS_AVAILABLE_IOS(6_0);
- (NSUInteger)supportedInterfaceOrient ations NS_AVAILABLE_IOS(6_0);
只有当第一个方法返回时yes时候才调用
// Returns interface orientation masks.
- (UIInterfaceOrientation)preferredInterfaceOrient ationForPresentation NS_AVAILABLE_IOS(6_0);
ios6.0摒弃了
- (BOOL)shouldAutorotateToInterf aceOrientation:(UIInterfaceOrientation)toInterfaceOrientation NS_DEPRECATED_IOS(2_0, 6_0);
如图所示
如果要支持横竖屏,也可使用代码,但在ios6.0之后使用新的几个方法
// New Autorotation support.
- (BOOL)shouldAutorotate NS_AVAILABLE_IOS(6_0);
- (NSUInteger)supportedInterfaceOrient
只有当第一个方法返回时yes时候才调用
// Returns interface orientation masks.
- (UIInterfaceOrientation)preferredInterfaceOrient
ios6.0摒弃了
- (BOOL)shouldAutorotateToInterf