Overflow on UILabels

Posted by jkeesh on Stack Overflow See other posts from Stack Overflow or by jkeesh
Published on 2010-03-12T08:56:09Z Indexed on 2010/03/12 9:07 UTC
Read the original article Hit count: 355

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 still 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?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uilabel