Are you recalculating the size of the label as well? Using the same logic?
I worked on the very same thing yesterday and that got it to work.

In my case the label's content can be very large, with string length up to 
120000 characters and I found out that a label's recalculated size doesn't work 
well if the string's length is larger than 20.000...




Op 28 apr. 2013, om 20:57 heeft Koen van der Drift <koenvanderdr...@gmail.com> 
het volgende geschreven:

> 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 (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/diederik%40tenhorses.com
> 
> This email sent to diede...@tenhorses.com
> 


_______________________________________________

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

Reply via email to