MultilineTitleButton

public class MultilineTitleButton : UIButton
  • internal only

MultilineTitleButton is a subclass of UIButtonand it allows for multiple lines of text to be displayed in the button’s title, and the button’s size is adjusted to fit the text. The content hugging priority is set s o that the button’s width and height can be adjusted by the Auto Layout system. *

  • init?(coder:) is used for creating an instance of the class from a nib file *

    Declaration

    Swift

    public required init?(coder aDecoder: NSCoder)
  • init(frame:) is used for creating an instance of the class programmatically

    Declaration

    Swift

    public override init(frame: CGRect)
  • The class overrides the intrinsicContentSize property to adjust the size of the button based on the intrinsic size of the title label and the content edge insets.

    Declaration

    Swift

    public override var intrinsicContentSize: CGSize { get }
  • It also overrides the layoutSubviews() function to set the preferred maximum layout width of the title label to the width of the button.

    Declaration

    Swift

    public override func layoutSubviews()