jkeesh
jkeesh

Reputation: 3339

Overflow on UILabels

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?

Upvotes: 1

Views: 811

Answers (1)

Warrior
Warrior

Reputation: 39374

Don't use lineBreakMode = UILineBreakModeWordWrap, just set the numberOfLines property to 3.

Upvotes: 3

Related Questions