旋转不同的表现上iOS6的 [英] Rotation behaving differently on iOS6

查看:178
本文介绍了旋转不同的表现上iOS6的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一个应用,该应用是标签为主。没有什么需要对景观模式,但一对夫妇的意见。它的工作确定对iOS5的,我是pretty满意的结果。然而,随着iOS6的和不与任何东西搞乱,现在所有旋转的意见和后果不是很好。

I did an App which is tab-based. Nothing needs to be on landscape mode but a couple of views. It worked OK on iOS5 and I was pretty happy with the result. However with iOS6 and without messing with anything, it now rotates all the views and the consequences are not nice.

由于其基于选项卡的应用程序,我需要在景观夫妇的看法是modalViews。这样,我没有用的TabBar不乱,我不得不只选择了支持面向画像构建选项设置,并设置:

Because its a tab-based app, the couple of view I need in landscape are modalViews. That way I didn't mess with the tabbar and I had only to chose portrait in the "Supported Orientations" setting on build options and set:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

上的意见,我想的风景线。

on the views I wanted landscape.

现在与iOS6的这个意见也都在纵向模式,不管是什么,他们不表明横向模式,即使我旋转设备。同样,如果我允许在支持的方向,他们都旋转,所有的方位不管我把上面的方法。

Now with iOS6 this views are also on portrait mode, no matter what and they do not show the landscape mode even if I rotate the device. Likewise, if I allow all the orientations on the "Supported orientations", they all rotate, no matter what I put on the method above.

在我还没有勾选使用自动布局关于故事板的所有视图。

On all the views I haven't check the box "Use Autolayout" on storyboards.

任何帮助吗?

* 修改的**
现在,我看到它时,应用程序我有在设备上正常工作。我已经安装了促销code,而不是从X code,只看到我的客户是否有问题或没有。 Fortunatelly他们不是。这个问题虽然仍然存在。

*EDIT** Now that I see it, the App I have on the device works fine. I've installed with a promo code, not from Xcode, only to see whether my customers are having problems or not. Fortunatelly they are not. The problem remains though.

推荐答案

我找到了这个问题的文件中最重要的部分是:

The most important part of the documentation I found for this issue is:

当用户改变设备方向时,系统调用这个
  根视图控制器或最上面的presented视图的方法
  控制器填充窗口

When the user changes the device orientation, the system calls this method on the root view controller or the topmost presented view controller that fills the window

为了让我的应用程序在iOS 6中全面工作自转,我必须做到以下几点:

To make my app fully working for autorotation in iOS 6, I had to do the following:

1)我创建的UINavigationController的新子类,并添加shouldAutorotate和supportedInterfaceOrientation方法:

1) I created a new subclass of UINavigationController, and added shouldAutorotate and supportedInterfaceOrientation methods:

// MyNavigationController.h:
#import <UIKit/UIKit.h>

@interface MyNavigationController : UINavigationController

@end

// MyNavigationController.m:
#import "MyNavigationController.h"
@implementation MyNavigationController
...
- (BOOL)shouldAutorotate {
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;
}
...
@end

2)在AppDelegate中,我也用我的新的子类,以显示我的根的ViewController(这是introScreenViewController,一个UIViewController子类)并没有设置self.window.rootViewController,所以它看起来是:

2) In the AppDelegate, I did use my new subclass to show my root ViewController (it is introScreenViewController, a UIViewController subclass) and did set the self.window.rootViewController, so it looks that:

    nvc = [[MyNavigationController alloc] initWithRootViewController:introScreenViewController];
    nvc.navigationBarHidden = YES;
    self.window.rootViewController = nvc;
    [window addSubview:nvc.view];
    [window makeKeyAndVisible];

这篇关于旋转不同的表现上iOS6的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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