EnterpriseDS Documentation

Class DSIcon​Button

@IBDesignable public final class DSIconButton: UIButton  

An Anatomy-styled, icon-only push button element that displays a standard icon (DSIconRenderingType) as well as all normal UIButton functionality. No title text is allowed.

For storyboards, add a UIButton to your view and change the class name to DSIconButton. BE SURE THE TYPE IS SET TO CUSTOM otherwise some colors won't show correctly.

If the button performs an asynchronous operation, you can present a spinning indicator by setting isLoading to true. This will also disable the button.

Initialize and set properties as needed.

let button = DSIconButton(icon: .gear)
DSIconButton DSIconButton UIButton UIButton DSIconButton->UIButton

Conforms To

UIButton

Initializers

init(icon:​)

public init(icon: DSIconRenderingType)  

Initializes and returns a newly allocated DSButton with the specified icon.

Parameters

icon DSIcon​Rendering​Type

The icon for DSIconButton. Can be changed after initialization as well.

Properties

icon

public var icon: DSIconRenderingType?  

An icon to display on the button.

icon​String

@IBInspectable public var iconString: String?  

The icon property representable by a String.

This property is only recommended for use in the Attributes inspector of a storyboard since enums are not @IBInspectable. Possible values are left and right. In code, use the icon property instead.

is​Enabled

public override var isEnabled: Bool  

is​Highlighted

public override var isHighlighted: Bool  

is​Selected

public override var isSelected: Bool  

is​Loading

public var isLoading: Bool = false  

When set to true, the button contents disappear and are replaced by a spinning indicator. The button will also become disabled. Use this when you want to keep the user from tapping the button during an asynchronous activity for example.

button​Type

public override var buttonType: UIButton.ButtonType  

intrinsic​Content​Size

public override var intrinsicContentSize: CGSize  

accessibility​Label

public override var accessibilityLabel: String?  

Methods

set​Title(_:​for:​)

public override func setTitle(_ title: String?, for state: UIControl.State)  

set​Attributed​Title(_:​for:​)

public override func setAttributedTitle(_ title: NSAttributedString?, for state: UIControl.State)  

prepare​For​Interface​Builder()

public override func prepareForInterfaceBuilder()