Skip to content

Instantly share code, notes, and snippets.

@Qiki
Last active February 26, 2016 03:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Qiki/995f6a0c93883b65e205 to your computer and use it in GitHub Desktop.
Save Qiki/995f6a0c93883b65e205 to your computer and use it in GitHub Desktop.
- (void)aboutSizeOfHeaderview {
// In order to show the label in the header view, we need to make the header view has a situable height
CGFloat padding = 8.0;
CGRect boundingRect = [self.wishListHeaderLabel.text boundingRectWithSize:CGSizeMake(self.view.bounds.size.width - (padding * 2), CGFLOAT_MAX) options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15.0f]} context:nil];
UIView *header = self.tableView.tableHeaderView;
CGRect rect = CGRectMake(0, 0, self.view.bounds.size.width,
boundingRect.size.height + 10.0f);
header.frame = rect;
self.tableView.tableHeaderView = header;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment