Hello there,
If you create a custom header for a UITableView, and you want to listen for some events on that header (ie: button TouchUpInside); what is the best place for subscribe and un-subscribe for that event?
Some sample code:
public override UIView GetViewForHeader (UITableView tableView, int section)
{
var view = new UIView (new RectangleF (0, 0, tableView.Bounds.Width, 44));
var label = new UILabel (new RectangleF (10, 17, 120, 16)) {
Text = "Test",
TextAlignment = UITextAlignment.Left,
Font = UIFont.FromName ("Helvetica-Bold", 15)
};
AddButton.Center = new PointF (tableView.Bounds.Width - 20, 24);
AddButton.TouchUpInside += HandleActivityAddTouched;
view.AddSubviews (label, AddButton);
return view;
}
As you can see above, I'm registering for TouchUpInside on the AddButton however I can't find a suitable place for un-register this event.
Thanks, R.