我正在寻找一种在GlassButton
单击时更改屏幕的方法。我刚刚开始学习 Monotouch.Dialog。我已经做了以下尝试来处理这个问题。
public override void ViewDidLoad ()
{
button.TouchUpInside += (sender, e) => {
this.NavigationController.PushViewController(list, true);
};
}
list 是 a UIViewController
,但在单击时this.NavigationController.PushViewController(list, true);
被指向一个空引用异常。 list
已经实例化并且不为空,但是,this.NavigationController
为空。我怎样才能解决这个问题?
GlassButton button = new GlassButton (new RectangleF(0, 0, 200, 50));
List list = new List ();
public static EntryElement lastName = new EntryElement (null, "Enter Last Name", null);
public static EntryElement firstName = new EntryElement (null, "Enter First Name", null);
public static EntryElement middleInitial = new EntryElement (null, "Enter Middle Initial", null);
public practice () : base (UITableViewStyle.Grouped, null)
{
Root = new RootElement ("Level 1") {
new Section() {
new RootElement("Level 2") {
new Section("Individual Information") {
lastName, firstName, middleInitial
},
new Section("Submit") {
button
}
}
}
};
}