Unfortunately, that won't compute the height of the UITableViewHeaderFooterView, which has two different labels with different text characteristics, and who know what positioning within.
On Aug 5, 2013, at 18:57 , synelang <synel...@gmail.com> wrote: > Try this : (never tested) > > • void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView > *)view forSection:(NSInteger)section_ > { > CGSize size = [dataString sizeWithFont:font constrainedToSize:size > lineBreakMode:UILineBreakModeWordWrap]; > CGFrame frame = view.frame; > frame.size.height = size.height; > • [view setFrame:frame]; > • } > > > > Original Message > Sender: Rick Mann<rm...@latencyzero.com> > Recipient: Cocoa Dev List<cocoa-dev@lists.apple.com> > Date: 星期二, 8月 6, 2013 09:25 > Subject: Computing the height for a UITableViewHeaderFooterView > > Is there any way around manually providing the height for a table header > view? If I simply provide a title string for the header, UITableView is able > to compute the height itself. But if I use a UITableViewHeaderFooterView and > set the textLabel and detailTextLabel, I also have to set the height (as far > as I can tell). > > But the text I'm rendering is dynamic, and could change the number of lines > used. Not sure how best to handle this. > > -- > Rick > > > > > _______________________________________________ > > Cocoa-dev mailing list ( > Cocoa-dev@lists.apple.com > ) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > > https://lists.apple.com/mailman/options/cocoa-dev/synelang%40gmail.com > > > This email sent to > synel...@gmail.com -- Rick _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com