Starting with iOS 5 you also need to implement
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
In addition to
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
Otherwise it will not work.
From Apple Link
The returned object may be a UILabel or UIImageView object, as well as a custom view. This method only works correctly when tableView: heightForHeaderInSection: is also implemented.
source share