Sourcecode

Please see the **UgTextLabelDemo** project for the source code created in this chapter. See [Installing examples](🔗) for information on how to download the examples.

The text label control is used to display text. We support a variety of functionality. Some important aspects in respect to text label are:

  • We support TTF (true type fonts) only. This make sure that the look and feel across platforms is identical

  • Our text label control wraps the respective iOS (UILabe) and Android (TextView) controls

## General Properties

Basic properties of TextLabel control are displayed in the General section

(Script tags will be stripped)

PropertyExplanation**********_**********Comment
NameName/ID of the text labelUse standard naming scheme for any control. We use camelCase starting with lb, i.e. lbLastName
AccessibilityProvides Accessibility shortcutSpecify the word that should be read out if VoiceOver is enabled See [Accessibility]
TextThe text that is displayed on the screen
BaselineType SCDWidgetsBaselineAlignment Vertical arrangement of text line. Supported values are _ **middle** _ **alphabetic** * **hanging**More information can be found here https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/alignment-baseline
Text alignmentType SCDLayoutHorizontalAlignment _ **left**, left aligned with the area covered by the label control _ **center**, centered within the area covered by the label control * **right**, right aligned within the area covered by the label controlIf the wrap text option is used, these settings will have no affect as the area covered by the label will wrap around the text and the alignment value will make no visible difference
EnableIf control is enabled or not
VisibleIf control is visible or not
Wrap TextIf Wrap Text is enabled, the text label's size shrinks to the minimal size so that it tightly wraps the text
MultilineIf enabled, text is displayed across multiple lines depending on the value of the text_ For iOS, we use NSLineBreakMode.byWordWrapping _ For Android, we use WordWrapping

# Setting properties (via binding or code)

(Script tags will be stripped)


or via code. Here we set the text alignment and baseline programmatically.



## Font Properties

The font is selected through the IDE and then copied into the mobile app project. The font properties are pretty self explanatory:

(Script tags will be stripped)


You can set some font properties dynamically:


(Script tags will be stripped)