IOS 6屏幕旋转而不使用故事板 [英] IOS 6 screen rotation without using storyboard

查看:60
本文介绍了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根本没有任何支持,适用于以前所有iOS上的3GS / 4S和4.3,5.0.5.1模拟器,但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)假])。这样你就拥有导航控制器的完整控制器。

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天全站免登陆