Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The Normal Stuff: Fields, Views, and Labels
You’re probably already familiar with UILabel, UITextField, and UITextView, so I discuss them only briefly here. They are the basic controls you use for day-to-day text layout.
UILabel is a lightweight, static text control. It is very common for developers to have problems with dynamic labels (labels with contents set programmatically) they create in Interface Builder. Here are a few tips for using UILabel:
■ UILabel can display multiline text. Just set its numberOfLines property in code or the Lines property in Interface Builder. This is the maximum number of lines. If you want it to be unbounded, set it to zero.
■ By default, Interface Builder turns on adjustsFontSizeToFitWidth. This can be surprising if you assign text that is wider than the label. Rather than truncating or overflowing the label, the text shrinks. Generally it’s a good idea to make your dynamic labels very wide to avoid truncating or resizing.