iOS6模拟器中的顶部主页按钮纵向方向无法正常工作

Chr*_*oph 7 ios6 xcode4.5

几分钟前我设置了XCode 4.5和iOS6模拟器.我的应用程序支持iPhone的所有4个方向,纵向底部和顶部主页按钮,左右横向.

好吧,我把它放到.plist中,因为它是iOS6所要求的,旧的shouldRotateTo ...方法仍然在那里返回YES.

但在模拟器中,应用程序不会旋转到纵向顶部主页按钮.

为什么?这是出于目的吗?它能在设备上正常工作吗?

谢谢.

Chr*_*oph 18

好的,我现在自己找到了答案.

这还不够

- (BOOL)shouldAutorotate {

    return YES;
}

- (NSUInteger)supportedInterfaceOrientations {

    return UIInterfaceOrientationMaskAll;
}
Run Code Online (Sandbox Code Playgroud)

在你的ViewController中,如果它被推入一个UINavigationViewController.该UINavigationViewController也必须有这些方法.您最好通过打开一个小类别来完成此操作UINavigationViewController.

这是我的UINavigationController-Rotation.h:

@interface UINavigationController (Rotation)
@end
Run Code Online (Sandbox Code Playgroud)

和我的UINavigationController-Rotation.m:

#import "UINavigationController-Rotation.h"

@implementation UINavigationController (Rotation)

#pragma From UINavigationController

- (BOOL)shouldAutorotate {

    BOOL result = self.topViewController.shouldAutorotate;

    return result;
}

- (NSUInteger)supportedInterfaceOrientations {

    NSUInteger result = self.topViewController.supportedInterfaceOrientations;

    return result;
}

#pragma -

@end
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助!