Label

public class Label : View

Label view, displays a string at a given position, can include multiple lines.

When labels are initiallly created, they compute a default width and height, and additional changes to the configuration of the label (the text, the lineBreak, the text alignemtn) will not automatically change that. You must call autoSize() if you want to change those parameters.

  • Accesses the content of the label as a String, if you want to use colors or attributed, set the attributedText property instead

    Declaration

    Swift

    public var text: String { get set }
  • Access the contents of the label as an attributed string

    Declaration

    Swift

    public var attributedText: AttributedString { get set }
  • Controls the line breaking method of the label, changing it will redisplay the label.

    Declaration

    Swift

    public var lineBreak: LineBreakMode { get set }
  • Controls the text-alignment property of the label, changing it will redisplay the label.

    Declaration

    Swift

    public var textAlignment: TextAlignment { get set }
  • Initializes a Label with the provided string

    Declaration

    Swift

    public convenience init (_ text: String,
                             align: TextAlignment = .left,
                             lineBreak: LineBreakMode = .byClipping)
  • Undocumented

    Declaration

    Swift

    public init (_ attrStr: AttributedString,
                 align: TextAlignment = .left,
                 lineBreak: LineBreakMode = .byClipping)
  • This function sets the View’s width and height properties based on the lineBreak mode and the contents of the string. This is called when the object is first constructed, but you must manually call it if you change the content of the label or other attributes, as those would not change the active size configuration.

    Declaration

    Swift

    public func autoSize()
  • Declaration

    Swift

    public override func redraw(region: Rect, painter: Painter)