EventHandler StatusClick;
EventHandler ConditionClick;
EventHandler PhotoClick;
public override void ViewWillAppear (bool animated)
{
base.ViewWillAppear (animated);
StatusClick = delegate {
DisplayStatus ();
};
ConditionClick = delegate {
DisplayConditions();
};
PhotoClick = delegate {
PickPhoto();
};
this.Condition.TouchUpInside += ConditionClick;
this.Status.TouchUpInside += StatusClick;
this.Photo.TouchUpInside += PhotoClick;
}
public override void ViewWillDisappear (bool animated)
{
base.ViewWillDisappear (animated);
this.Status.TouchUpInside -= StatusClick;
this.Condition.TouchUpInside -= ConditionClick;
this.Photo.TouchUpInside -= PhotoClick;
}
Side projects, and non-profit work. Always in search of the indefinable hack.
Saturday, March 2, 2013
ViewWillDisappear ViewWillAppear Monotouch.
When you deal in buttons, you need to make sure in your ViewWillDisappear, and your ViewWillAppear, that you subscribe to events for your buttons and unsubscribe. Just so that while the new view is being presented, you don't get hit with an error.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment