UILabel class implements a read-only text view. You can use this class to draw one or multiple lines of static text, such as those you might use to identify other parts of your user interface. The base
UILabel class provides support for both simple and complex styling of the label text. You can also control over aspects of appearance, such as whether the label uses a shadow or draws with a highlight. If needed, you can customize the appearance of your text further by subclassing.
- iOS 2.0+
- tvOS 2.0+
The default content mode of the
UILabel class is
redraw. This mode causes the view to redraw its contents every time its bounding rectangle changes. You can change this mode by modifying the inherited
contentMode property of the class.
New label objects are configured to disregard user events and clip subviews by default. If you want to handle events in a custom subclass of
UILabel, you must explicitly change the value of the
isUserInteractionEnabled property to
true after initializing the object. If you want to allow subviews to extend beyond the bounds of a label, you must explicitly change the value of the label’s
clipsToBounds property to
For information about basic view behaviors, see View Programming Guide for iOS.