upSideDown iPhone方向在iOS 6中不起作用?

iOm*_*Omi 5 objective-c uiinterfaceorientation uideviceorientation ios6 xcode4.5

希望你会好起来,尽力而为.

upSideDown Orientation在我iOS 6身上遇到了问题,而我认为我做的一切都很完美,但我不知道为什么它不适合我.我和你分享我的问题,以便得到任何解决方案.

到目前为止我做了什么:

a)在xcode项目摘要选项卡中,我启用了所有4个方向.

b)我在所有控制器类中都添加了一段代码(如下所示).

-(BOOL)shouldAutorotate
{
    return YES;
}
-(NSInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}
Run Code Online (Sandbox Code Playgroud)

但仍然upSideDown Orientation无法正常工作

谢谢你的期待.

iOm*_*Omi 8

我找到了解决方案.

我们需要创建一个单独的类UINavigation Controller.在.m文件中添加以下方法

// Deprecated in iOS6, still needed for iOS5 support.
// ---

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    //    return (interfaceOrientation == UIInterfaceOrientationPortrait);
    return YES;
}

// iOS6 support
// ---
- (BOOL)shouldAutorotate
{
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskAll;
}
Run Code Online (Sandbox Code Playgroud)

现在将这个新创建的类分配给Navigation Controller故事板.还要.m在"项目 - >构建设置 - >编译源"中添加此类的文件.运行项目,它将支持并执行所有方向,包括upSideDown.

我希望它能帮到你们所有人.

问候