我有一个应用程序,它有 5.0 作为部署目标,6.1 作为基本 sdk,它在 iOS 6.x 设备/模拟器上运行良好。但是在 5.x 上,我的观点没有旋转。我在谷歌上搜索并找到了一些关于此的 Stackoverflow 帖子,但我无法在其中找到正面和反面。我想我需要实现我自己使用的不同 View Controller 的子类,但是我是对的吗?
在我的应用委托(delegate) didFinishLaunchingWithOptions
我用它来创建我的应用程序:
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = @[viewController1, viewController2, viewController3];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
我创建了我的 viewController1.. 像这样:
viewController1 = [[UINavigationController alloc] initWithRootViewController:[[SearchVC alloc] initWithNibName:@"SearchVC_iPhone" bundle:nil]];
我已经尝试实现
shouldAutorotateToInterfaceOrientation
在我的 SearchVC_iPhone View Controller 中,我尝试了子类化 UINavigationController
并实现shouldAutorotateToInterfaceOrientation
在那个子类中,但它不适合我,我真的只是在这里猜测。请知道这些东西的任何人都可以在这里帮助我,我需要做些什么才能让它在 iOS 5.x 中也能正常工作?
谢谢
索伦
最佳答案
在 IOS5 中,您可以使用
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return YES;
}
在 IOS6 中,您可以使用
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
关于ios - 为什么旋转在 iOS 6 上工作时对 iOS 5 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15198536/