Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to limit max width of UILabel?

There are a UILabel in the center of the UIView, named nicknameLabel, and will append a gender image after the nicknameLabel.

But when the nicknameLabel has a lot of text, it will beyond the bounds of the UIView.

enter image description here

So, how to limit max width of UILabel?

BTW: I using the storyboard. Thanks.

like image 208
backslash112 Avatar asked Dec 24 '14 05:12

backslash112


People also ask

How do you change the width of a UILabel?

To change the font or the size of a UILabel in a Storyboard or . XIB file, open it in the interface builder. Select the label and then open up the Attribute Inspector (CMD + Option + 5). Select the button on the font box and then you can change your text size or font.

What is UILabel?

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


1 Answers

Give the label a <= constraint like this:

enter image description here

like image 108
backslash112 Avatar answered Sep 20 '22 17:09

backslash112