Forum Xamarin Xamarin.iOS

How do you add a custom Table Header (for the whole table, not for a section)?

I've been searching now for 2 days and can't find any examples with the iOS equivalent of UITableViewHeaderFooterView

Any suggestions of where to find this?


  • Alejandro.RamirezAlejandro.Ramirez USMember
    edited December 2014

    For those of you still scratching your head with the issue of adding a custom Table Header (not a section header), here's the solution:

    1. Create a XIB file and customize its contents
    2. In your ViewDidLoad method add the following code:

                  NSArray array = NSBundle.MainBundle.LoadNib("NameOfYourXIBFile", this, null);
                  UIView view = Runtime.GetNSObject(array.ValueAt(0)) as UIView;
                  this.TableView.TableHeaderView = view;

    Bonus: repeat the same procedure for a custom Table Footer, but instead do in the last line:

    this.TableView.TableFooterView = view;

  • HleeDHleeD UAMember

    Thanks You very much, it helped Me !
    Best Regards !

Sign In or Register to comment.