Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make UILabel text appear with ellipsis at the end when text is longer than label's width

Tags:

People also ask

How do I change my UILabel text?

Changing the text of an existing UILabel can be done by accessing and modifying the text property of the UILabel . This can be done directly using String literals or indirectly using variables.

How do I make my text bold on UILabel?

Double Click on Bold to select it, and then right click on it to see more options. Select font > Bold from that option. It should do the task.

Is UILabel a view?

A view that displays one or more lines of informational text.

What is label in Xcode?

A standard label for user interface items, consisting of an icon with a title.


My issue is with a UILabel.

The text it holds is much longer than the actual width of the UILabel. So I would like it to appear with "..." (an ellipsis) at the end to denote that there's more text.

I played around with horizontal content hugging priority (made it less than 251) but it doesn't seem to make a difference.

Right now it just chops the text when the width fills up.