I'm having some problems to resize and show all text in a UITableViewCell based
on the contents. It has two labels, the second of which can have a variable
length and I'd like to show it all.
So I added this code:
- (CGFloat)tableView:(UITableView *)tableView
heightForRowAtIndexPath:(NSIndexPath *)indexPath;
{
Note *n = [self.notes objectAtIndex: [indexPath row]];
CGSize constraint = CGSizeMake(320, 2000.0f);
CGSize size = [n.content sizeWithFont: [UIFont systemFontOfSize: 14.0f]
constrainedToSize: constraint
lineBreakMode: NSLineBreakByWordWrapping];
CGFloat height = MAX(size.height, 44.0f);
return height + 44.0f;
}
The problem is that the height of the cell is changing, but it still shows only
one line of the second label. I have also set the numberOfLines to 0, which
according to the docs "To remove any maximum limit, and use as many lines as
needed, set the value of this property to 0."
How can I fix this?
Thanks,
- Koen.
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]