Check out How to create custom UITableViewHeader programmatically using autolayout by JR. Here is an excerpt:
Create a new UITableViewCell for the header. Add your autolayout contraints. Then use in ViewController.
TrackHeaderCell.h
#import <UIKit/UIKit.h> @interface TrackHeaderCell : UITableViewCell @property (strong, nonatomic) UILabel *titleLabel; @endTrackHeaderCell.m
#import...
The full article is available here.