Create Class
New File -> Objective-C Class -> MyHeaderView
// init from nib file
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self) {
...
}
return self;
}
//after nib-loading
- (void)awakeFromNib
{
....
}
//custom layerout
- (void)layoutSubviews
{
[super layoutSubviews];
....
}
Create the xib file
New File -> User Interface -> View -> MyHeaderView
Adjusting UIView
Simulated Metrics
Size: Freeform
Status Bar: None
Top Bar: None
Buttom Bar: None
Custom Class
Class: MyHeaderView
loading xib file
MyHeaderView *myHeaderView = [[[NSBundle mainBundle] loadNibNamed:@"MyHeaderView" owner:self options:nil] lastObject];
self.tableView.tableHeaderView = myHeaderView;