Last active
December 13, 2015 19:08
-
-
Save yetanotherchris/4959948 to your computer and use it in GitHub Desktop.
Monotouch: ViewDidLoad, ViewWillAppear, ViewDidAppear
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Level2ViewController : UIViewController | |
{ | |
public override void ViewDidLoad() | |
{ | |
Title = "Level 2"; | |
UILabel label = new UILabel(); | |
label.Text = "Level2ViewController"; | |
label.Frame = new System.Drawing.RectangleF(100, 100, 100, 100); | |
View.AddSubview(label); | |
// A new toolbar with items | |
UIBarButtonItem item = new UIBarButtonItem(); | |
item.Title = "Another item"; | |
item.Clicked += delegate(object sender, EventArgs e) | |
{ | |
Level3ViewController controller = new Level3ViewController(); | |
NavigationController.PushViewController(controller, true); | |
}; | |
ToolbarItems = new UIBarButtonItem[] { item }; | |
base.ViewDidLoad(); | |
} | |
public override void ViewWillAppear(bool animated) | |
{ | |
// Re-show the toolbar here for consistency | |
NavigationController.SetToolbarHidden(false, true); | |
base.ViewWillAppear(animated); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment