UIButton

public extension UIButton
  • Sets the button’s title underlined with style and for state specified.

    Declaration

    Swift

    func setUnderlined(title: String, style: NSUnderlineStyle = NSUnderlineStyle.single, color: UIColor? = .none, forState state: UIControl.State = .normal)

    Parameters

    title

    Title for the button.

    style

    NSUnderlineStyle with which the title is underlined. By default, StyleSingle.

    color

    UIColor for the underline, or None if the color should be the same as the foreground’s. By default, None.

    forState

    UIControlState for which to set the title. By default, Normal.

  • Sets the button’s title and image with the specified spacing and arrangement.

    Seealso

    CGAffineTransform(scaleX:y:)

    Declaration

    Swift

    func setTitle(title: String, image: UIImage, spacing: CGFloat = 0, imageOnRight: Bool = false)

    Parameters

    title

    Title for the button.

    image

    Image for the button.

    spacing

    Spacing between the title and the button.

    imageOnRight

    Boolean indicating whether the the image should be to the right of the text or to the left. By default, false (to the left).