使用iOS 5.1的Xcode 4.5 SplitView破坏方向(在iOS6思想上工作) [英] Xcode 4.5 SplitView broken orientation with iOS 5.1 (working on iOS6 thought)

查看:108
本文介绍了使用iOS 5.1的Xcode 4.5 SplitView破坏方向(在iOS6思想上工作)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当Xcode更新到v4.5时,我正在开发一个splitView项目。从那时起,自转就完美了。更新后,自动旋转仅适用于iOS 6.在iOS 5.1上,我在Portrait中堆叠。我已经阅读了所有可能的解决方案,但似乎没有什么能解决我的问题。以下是我到目前为止所做的事情:

I was working on a splitView project when the Xcode was updated to v4.5. Since then autorotation was working perfectly. After the update, autorotation works only for iOS 6. On iOS 5.1 i am stack in Portrait. I have read all possible solutions but nothing seems to be able to fix my problem. Below is what i have done so far:

检查所有方向都在我的plist中。
替换(BOOL)shouldAutorotateToInterfaceOrientation:
with

Checked that All orientations are in my plist. Replaced (BOOL)shouldAutorotateToInterfaceOrientation: with

- (BOOL)shouldAutorotate
{
    return TRUE;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeRight;
}

我在应用代表中添加了以下代码段

I added the below snippet in the app delegate

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
    {
        return (UIInterfaceOrientationMaskAll);
    }

我在另一个答案中显示下面的代码片段我怎么不知道如何在splitView控制器中实现它

I show in another answer the below snippet how ever i am not sure how to implement it in a splitView controller

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
   ...
   window.rootViewController = topLevelViewController;
   ...
}

任何人都可以帮我解决这个问题吗?

Can anybody help me out with this?

推荐答案

您需要保留iOS 5中的方法:

You need to keep the method from iOS 5:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;
}

继续支持iOS 5.因此,保留两个新的适用于iOS 5的iOS 6和旧版本5.请注意,要在iOS 5 所有中旋转UISplitView,所附的视图控制器必须具有上述方法。

to continue support for iOS 5. You thus, keep both the new ones for iOS 6 and the old ones for iOS 5. Note that for the UISplitView to rotate in iOS 5 all the enclosed view controllers have to have the above method.

这篇关于使用iOS 5.1的Xcode 4.5 SplitView破坏方向(在iOS6思想上工作)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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