I have a table view that I am customizing and I am adding a UILabel as a subview of the contentView, and I want the number of lines to be relatively consistent.
I set the numberOfLines
property to be 3 so it can't go more than that, but there are stil开发者_开发技巧l some that overflow onto the 4th line.
If it overflows, I want to add a a trailing ...
How can I figure out if it overflows? I've tried truncating at different character counts of my string, but since I am using lineBreakMode = UILineBreakModeWordWrap
the number of characters doesn't really predict the number of lines.
Is there a way to find out the number of lines your UILabel
is using?
Don't use lineBreakMode = UILineBreakModeWordWrap
, just set the numberOfLines property to 3.
精彩评论