Xamarin.iOS中未调用ShouldAutorotate和GetSupportedInterfaceOrientations

koc*_*fan 5 rotation uiviewcontroller xamarin.ios xamarin

我做了一个UIViewController像

public class MyViewController : UIViewController
{
    ...

    public override bool ShouldAutorotate ()
    {
        return true;
    }

    public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations ()
    {
        return UIInterfaceOrientationMask.AllButUpsideDown;
    }
}
Run Code Online (Sandbox Code Playgroud)

并在AppDelegate.cs中使用它。

Window.RootViewController = new MyViewController();
Run Code Online (Sandbox Code Playgroud)

当我运行这段代码时,“ ShouldAutorotate”和“ GetSupportedInterfaceOrientations”在视图初始化阶段被多次调用,但是在显示应用程序视图之后,它们再也不会调用。

我检查了Info.plist中的方向设置是否有效。iOS SDK目标为7.1,Xamarin Studio版本为5.0.1(内部版本3),Xamarin.iOS版本为7.2.3.39。

有任何想法吗?

Aar*_*her -1

iOS 在视图加载时检查这些并缓存答案以供在显示期间使用。