A label describes an onscreen interface element or provides a short message. Although people can’t edit labels, they can sometimes copy the content of labels. Labels can display any amount of static text but are best kept short.
- Keep labels legible. Labels can include plain or styled text. If you adjust the style of a label or use custom fonts, be sure to not sacrifice legibility. It’s best to adopt Dynamic Type so your labels still look good when a user changes text size on their device.
How to use
- Drop a
Labelcontrol from the object panel to a
- Use the
Label Inspectorto customize its properties like
The inspector where the
Label class can be configured.
- Drop a
Buttoncontrol from the object panel to a
- Open the
Code Editor(cmd + 6)
- Select the
Actionitem inside the
Eventsarea and write your custom code in the
Label1.text = "Label Text"
Most important properties
Several UI aspects can be configured in the
Label class but the
textColor are the most commons to be configured.
text: The text displayed by the label.
font: The font of the text.
textColor: The color of the text.
Label class reference contains a complete list of properties and methods that can be used to customize a