我有一箇舊的iPad應用程序,它僅以橫向顯示。我試圖在iOS 6中運行相同的應用程序,並且應用程序以縱向模式啓動,與視圖控制器方向設置無關。我知道iOS 6中有變化,如下所示。我的iOS應用程序中的方向問題
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight) || (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationLandscapeLeft;
}
雖然我在代碼中有這些行,但似乎並沒有改變方向。 我還注意到,主窗口xib窗口處於縱向模式。是否有可能改變窗口的方向或是由於其他原因?
您使用的方向NavigationController在你的應用程序?如果是這種情況,那麼navigationController會妨礙你的方向。另外'shouldAutorotateToInterfaceOrientation'在iOS6中已被棄用。 – nsgulliver