如何以编程方式在Xamarin中嵌入视图?

时间:2015-07-02 21:45:07

标签: c# user-interface xamarin

我尝试使用Xamarin以编程方式设置用户界面。 (C#)。如何嵌入说导航控制器,标签栏控制器和页面控制器?提前谢谢。

1 个答案:

答案 0 :(得分:2)

您可以将其放入AppDelegate的FinishedLaunching

        var tab = new UITabBarController ();

        var nav1 = new UINavigationController (new MyViewController1 ());
        var nav2 = new UINavigationController (new MyViewController2 ());
        var nav3 = new UINavigationController (new MyViewController3 ());

        tab.ChildViewControllers = new [] { nav1, nav2, nav3 };

        Window.RootViewController = tab;