I have a UITableViewCell with several stacked UILabels:

- label1: set to 1 line, height = single line height, fixed bottom spacing
- label2: set to 2 lines, height ≥ single line height, fixed bottom spacing
- label3: set to 0 lines, height ≥ single line height, bottom spacing ≥ min 
spacing

The layout works in the sense that everything lays out based on the 
constraints, but if label3's text doesn't entirely fit within the allotted 
space then I want to see it truncated with an ellipsis. Instead label3's height 
generally is not an even multiple of its line height so any lines that are not 
entirely visible just don't get drawn.

I tried overriding -layoutSubviews or -updateConstraints in my UITableViewCell 
subclass, calling super, then figuring that I could set label3.numberOfLines 
based on the number of lines that evenly fit into the new value of 
label3.frame.size.height, but after calling super the height hadn't changed 
from its initial single-line value.

Are these the right places to do this and I'm just missing some extra work or 
is there a better way?


_______________________________________________

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