ios - 为什么旋转在 iOS 6 上工作时对 iOS 5 不起作用

标签 ios ios5 ios6 uiviewcontroller

我有一个应用程序,它有 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/

相关文章:

ios - 在 Xcode 项目中,我收到此链接器命令错误,退出代码为 1

ios - 导出联系人到iphone通讯录?

ios - UIView 子类(自定义进度 View )不会显示,直到为时已晚

iphone - iOS 5 隐藏 tabBarItem 文本标签

iphone - 在ios的特定类中使用自动引用计数

ios6 - iOS 6 中的导航栏看起来像 iOS 7 中的导航栏

iphone - 修改iOS中隐藏式字幕的字体、文本颜色

ios - 如何向 UINavigationBar 添加自定义按钮(类似于 Foursquare)

iphone - iOS - UITableView 滚动条超出屏幕

ios - 如果我使用 iOS7 SDK 构建,我的应用程序在旧设备上是否会有新外观?