【问题标题】:MonoTouch SupportedInterfaceOrientations not found未找到 MonoTouch SupportedInterfaceOrientations
【发布时间】:2013-02-07 13:34:09
【问题描述】:

在带有 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)”形式的错误。

任何建议表示赞赏!

比尔。

【问题讨论】:

    标签: xamarin.ios screen-rotation


    【解决方案1】:

    UIViewController 定义了 GetSupportedInterfaceOrientations,您可以在 UITabBarControllerUINavigationController 子类中覆盖它。

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

    【讨论】:

    • 谢谢 Poupou。你刚刚打败了我。我们在南半球有点慢。
    • 您好,我也遇到了同样的问题。你能解释一下你是如何解决你的问题的吗?
    猜你喜欢
    • 1970-01-01
    • 2013-06-20
    • 1970-01-01
    • 1970-01-01
    • 2019-12-23
    • 1970-01-01
    • 1970-01-01
    • 2011-08-01
    • 1970-01-01
    相关资源
    最近更新 更多