IOS 6屏幕旋转不使用情节提要 [英] IOS 6 screen rotation without using storyboard

查看:39
本文介绍了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屏幕旋转不使用情节提要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆