为什么 iPhone 5 不倒转 [英] why iPhone 5 doesn't rotate to upsideDown

查看:12
本文介绍了为什么 iPhone 5 不倒转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了新的方法,以我的代码像在苹果iOS 6中之证件但在iPhone 5中所述的应用程序不旋转到倒置.只有景观途径.

i added the new methods to my code like described at apples iOS 6 Documentations but on the iPhone 5 the App doesn't rotate to upside down. Only the to landscape Ways.

下面我的代码从RootViewController的:

Here my Code from the rootViewController:

- (NSUInteger)supportedInterfaceOrientations{
    NSLog(@">>> Entering %s <<<", __PRETTY_FUNCTION__);
    return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft |
            UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown);
}
- (BOOL)shouldAutorotate{
    NSLog(@">>> Entering %s <<<", __PRETTY_FUNCTION__);
    return YES;
}

我还tryed UIInterfaceOrientationMaskAll",但没有改变.奇怪的是,我的iPhone 4与iOS6的不具有相同的代码totateØ倒挂.

i tryed also "UIInterfaceOrientationMaskAll" but no changes. The Strange is, my iPhone 4 with iOS6 does totate o upside down with the same code.

任何想法?

推荐答案

IOS 6用途默认取向<代码> UIInterfaceOrientationMaskAll 为iPad和 UIInterfaceOrientationMaskAllButUpsideDown 的iPhone.如果你想你的iPhone ViewControllers旋转至所有方向包括颠倒,你必须添加iOS 6的方法:

IOS 6 uses default Orientation UIInterfaceOrientationMaskAllfor iPad and UIInterfaceOrientationMaskAllButUpsideDownfor iPhone. If you want your ViewControllers on the iPhone to rotate to ALL orientations including UpsideDown you must add the iOS 6 method:

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

要所有视图控制器.如果你这样做,它不工作,然后我用的是TabViewController或NavigationController其中的一些看法都没有返回这个你打赌.所有ViewControllers必须返回这对任何一个国家支持它.

to all view controllers. If you've done this and it is not working then I am betting your using a TabViewController or NavigationController where some of the views are NOT returning this. All ViewControllers must return this for ANY of them to support it.

另外,您可以添加一个类别的UITabViewController或NavigationController类,它是你的RootViewController的并覆盖方法.你这样做,就像这样:

Alternatively you can add a Category to the UITabViewController or NavigationController class that is your rootViewController and override that method. You do that like so:

<代码> @interface的UITabBarController(RotationAll)- (NSUInteger)supportedInterfaceOrientations;@结尾@implementation的UITabBarController(RotationAll)- (NSUInteger)supportedInterfaceOrientations {返回 UIInterfaceOrientationMaskAll;}@结尾

此外,这些是目前推荐的办法目前正在苹果开发者论坛与苹果公司的工作人员说,早期的说明文件的UINavigationController的泄气子类化是过时了讨论,并作为iOS 6中的它是确定要做到这一点.

Also these are the currently recommended approaches now being discussed in Apple Developer Forums with Apple staff saying earlier documentation that discouraged sub classing of UINavigationController is out of date, and as of iOS 6 it is ok to do that.

这篇关于为什么 iPhone 5 不倒转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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