IOS 6 screen rotation without using storyboard(IOS 6屏幕旋转不使用情节提要)
问题描述
任何尝试最新 iOS 6 测试版(版本 2 或 3)的人都有相同的自动旋转不起作用的经历?
Anyone who's trying the newest iOS 6 beta(version 2 or 3) has the same experience of auto rotation not working?
我没有使用故事板,而是纯粹的导航控制:
I am not using storyboard but pure navigation control:
self.navController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
[self.window addSubview:navController.view];
还有:
- (BOOL)shouldAutorotateToInterfaceOrientation: ](UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
}
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
但是 IOS 根本没有支持,在 3GS/4S 和 4.3,5.0.5.1 模拟器上与所有以前的 iOS 都可以正常工作,但 iOS 6 似乎只是错误
BUT IOS has no espouse at all, works fine with all previous iOS on 3GS/4S and 4.3,5.0.5.1 simulator, but iOS 6 seems just buggy
推荐答案
解决方案是:由于我的应用试图从 4.3+ 开始支持,因此我必须使用导航控制器来进行每个视图切换.
The solution is that: Since my app is trying to support from 4.3+, I have to use the navigation controller to do every view switch.
通过 ios6 似乎代表导航控制器,我必须定义自己的导航控制器,并设置条件和函数来更改其旋转行为.
by ios6 seems delegates to the navigation controller, I have to define my own navigation controller, and setup conditions and functions to change its rotation behaviour.
当我加载视图时,我会执行 ([self.navigationCONtroller setEnableLandscape:(BOOL)false]).这样你就拥有了导航控制器的完整控制器.
When I load a view, I then do([self.navigationCOntroller setEnableLandscape:(BOOL)false]). in that way you have full controller of your navigation controller.
注意:我确实尝试过覆盖导航控制器方法,但似乎只是被忽略了.(这只发生在 ios 6.0 上),还没有测试 6.1,所以不确定它是否得到修复(如果有,请告诉我)
NOTE: I did try override the navigation controller methods, but seems just get ignored. (This only happens to ios 6.0 as well), haven't test 6.1 yet, so not sure if it's get fixed(which please let me know if it does)
这篇关于IOS 6屏幕旋转不使用情节提要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:IOS 6屏幕旋转不使用情节提要


基础教程推荐
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01