public override void ViewDidLoad() { Title = "Home"; // A 'view' aka label control for this view UILabel label = new UILabel(); label.Text = "HomeViewController"; label.Frame = Center(100,100); label.BackgroundColor = UIColor.LightGray; View.AddSubview(label); // 2 toolbar items UIBarButtonItem item1 = new UIBarButtonItem(); item1.Title = "Click me"; item1.Clicked += delegate(object sender, EventArgs e) { Level2ViewController controller = new Level2ViewController(); NavigationController.PushViewController(controller,true); }; UIBarButtonItem item2 = new UIBarButtonItem(); item2.Title = "View with no back"; item2.Clicked += delegate(object sender, EventArgs e) { ViewWithNoBackController controller = new ViewWithNoBackController(); NavigationController.PushViewController(controller,true); }; ToolbarItems = new UIBarButtonItem[] {item1,item2}; base.ViewDidLoad (); }
// public override void ViewDidLoad () // { // _firstController = new HomeViewController(); // PushViewController(_firstController,true); // // base.ViewDidLoad (); // } public override void ViewDidLoad() { var firstController = new HomeViewController(); var secondController = new Level2ViewController(); var thirdController = new Level3ViewController(); var viewControllers = ViewControllers.ToList(); viewControllers.Add(firstController); viewControllers.Add(secondController); viewControllers.Add(thirdController); ViewControllers = viewControllers.ToArray(); base.ViewDidLoad (); }