【发布时间】:2013-08-22 06:12:29
【问题描述】:
我需要:以编程方式将设备从纵向旋转到横向,兼容 iOS6 和 iOS5。
问题:我不能在ios6上使用[UIDevice setOrientation]函数。
我有什么:iOS6 的代码:
- (BOOL) shouldAutorotate
{
return YES;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeLeft;
}
iOS5 的代码:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
所以,我需要编写在 iOS5 上旋转的代码:
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// [[UIDevice currentDevice] setOrientation] - I cannot use it
// ???
}
【问题讨论】:
标签: ios5 ios6 uiviewcontroller uiinterfaceorientation