未找到MonoTouch SupportedInterfaceOrientations

时间:2013-02-22 01:58:45

标签: xamarin.ios screen-rotation

在带有SDK 6.1的MonoTouch 6.0.10中,我在tabbarcontroller和navigationcontroller中有以下内容:

public override bool ShouldAutorotate()
{
    return true;
}

public override UIInterfaceOrientationMask SupportedInterfaceOrientations()
{
    var orientations = ParentViewController.GetSupportedInterfaceOrientations();
    foreach ( var controller in ViewControllers )
        orientations = orientations & controller.GetSupportedInterfaceOrientations();
    return orientations;
}

在AppDelegate中我有:

public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations (UIApplication application, UIWindow forWindow)
{
    return UIInterfaceOrientationMask.All;
}

在FinishedLaunching中我有:

window.RootViewController = tabController;

在tabbarcontroller和navigationcontroller中,这会得到一个错误,形式为'HelloWorld.TabController.SupportedInterfaceOrientations()被标记为覆盖但没有找到合适的方法来覆盖(CS0115)。'

任何建议都表示赞赏!

比尔。

1 个答案:

答案 0 :(得分:2)

UIViewController定义GetSupportedInterfaceOrientations,您可以在UITabBarControllerUINavigationController子类中覆盖这些内容。

C#编译器错误消息(和您的代码)显示您缺少Get前缀。