Adnan Ahmad
Adnan Ahmad

Reputation: 447

UILabel string truncate

I have a problem, is there any way to truncate the text of a label without changing its' font-size?
Let's suppose a width of label is 200 and string size is more then 200, it will then squeeze the string and make it size to small to read.
I'm looking for a way to adjust the string length to 200 and truncate rest.

Upvotes: 1

Views: 144

Answers (1)

Greg
Greg

Reputation: 33650

If you do not want the font size to be adjusted in order for the text to fit into the width of the label, you can set the adjustsFontSizeToFitWidth property of the label to NO.

See the UILabel class reference for more information. You will also want to read about the numberOfLines and lineBreakMode properties, as they also affect how truncation of the text in a UILabel works.

Upvotes: 2

Related Questions