[英]Rotation isn't working in iOS5 Storyboard
我正在使用情節提要應用程序,並且輪換可以在iOS6設備上使用,但是當我在iOS5設備上運行時,它不會旋轉。 我在導航控制器中嵌入了一個視圖控制器(因此,導航控制器是窗口的根視圖控制器),並且重寫了以下方法:
- (BOOL)shouldAutorotate
{
return YES;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight|UIInterfaceOrientationMaskLandscapeLeft|UIInterfaceOrientationMaskPortrait;
}
-(BOOL)shouldAutoRotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight) || (interfaceOrientation ==UIInterfaceOrientationPortrait)){
return YES;
} else {
return NO;
}
}
我在plist中也允許3種方向,我的部署目標是使用基本SDK iOS6的iOS5,並且自動布局已關閉,為什么這種方法不起作用?
謝謝!
您的評論使我更加接近。 這是因為您在自動旋轉中使用大寫字母“ R”。
將您的方法名稱更改為: shouldAutorotateToInterfaceOrientation:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.