Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Monotouch: ViewDidLoad, ViewWillAppear, ViewDidAppear
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
You can’t perform that action at this time.