2

BUMP .. 还没有弄清楚,东西在旋转,但不在视线范围内。太奇怪了。我可以提供更好的信息以获得帮助吗?

仍然有这个问题!真的很糟糕,我无法解决这个问题:(请帮助

BUMP ..请我死在这里!任何人!:)

所以,我正在使用Monotouch.Dialog并且从 IOS 6 开始,我的 splitview 控制器的旋转行为很奇怪。

它实际上是在旋转,但我的详细视图占据了整个屏幕,而主视图似乎被旋转出了屏幕框架。也就是说,当它旋转时我可以看到主视图一秒钟然后它就消失了,而细节视图占据了整个屏幕。

我已经添加了必要的ShouldAutorotate功能并设置了GetSupportedInterfaceOrientations自 IOS 6 以来。就像我说的它旋转,但有些东西刚刚关闭。

我试过IOS 5模拟器,它可以工作,所以这绝对是IOS 6的问题。

任何人都知道我应该在哪里寻找问题?

编辑:我在调试时注意到它不会进入我的主视图和详细视图的 ShouldAutorotate 覆盖,只有在我的拆分视图控制器中才会进入。在 iOS 5 中,它会正确进入 ShouldAutorotateToInterfaceOrientation。

这是我在详细视图和主视图中使用的代码:

public override bool ShouldAutorotate()
    {
        return true;
    }
    [Obsolete]
    public override bool ShouldAutorotateToInterfaceOrientation       (MonoTouch.UIKit.UIInterfaceOrientation toInterfaceOrientation)
    {
        return true;
    }

这是我的 SplitViewController 中的代码:

public override bool ShouldAutorotate()
    {
        return true;
    }

    [Obsolete]
    public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation requested)
    {
        return requested == UIInterfaceOrientation.LandscapeRight || requested == UIInterfaceOrientation.LandscapeLeft;
        //return requested == UIInterfaceOrientation.Portrait || requested == UIInterfaceOrientation.PortraitUpsideDown;

    }

    public override bool ShouldAutomaticallyForwardRotationMethods {
        get {
            return true;
        }
    }

请问有人吗?我的工作需要这个,但我无法解决这个问题!任何想法都会有所帮助!

4

2 回答 2

0

不看代码本身就很难猜出哪里出了问题。它很可能在 iOS 5.x 上运行,因为它将调用旧的shouldAutorotateToInterfaceOrientation:选择器(并且因为您的应用程序和/或 MonoTouch.Dialog 已经支持它)。

这在 iOS6 中已被弃用- 但仍会调用它以实现向后兼容性,除非您实现它的替换。注意 Apple 文档中的复数形式replaces

改写supportedInterfaceOrientations 和preferredInterfaceOrientationForPresentation 方法。)

弃用通知并不意味着 iOS6 不能与旧 API 一起使用。剩下的就是添加了一些新的、更好的 API,并且旧的 API可以在未来的一些 iOS 版本中删除(到目前为止,删除非常少见)。

注意:我鼓励您停止使用您不支持的 iOS 版本的旧 API(例如,在 iOS 4.0 中不推荐使用的东西应该在仅支持 5.0 及更高版本的应用程序中使用)。然而,复制代码以支持 5.0 和 6.0的最佳API 可能不是一个好主意,除非您从中获得一些东西(例如新功能)。

大多数新 API(弃用旧 API)都是为了让您的生活更轻松,而不是更难。

于 2012-10-09T18:08:55.573 回答
0

也不要忘记设置window.rootViewController(否则旋转在 iPad 上不起作用)。

于 2013-08-21T14:12:37.497 回答