Button
@available(iOS 9.0, *)
public class Button : UIButton
A UIButton that handles its own action.
-
Creates a UIButton
Declaration
Swift
public init( title: String, titleColor: UIColor? = nil, backgroundColor: UIColor? = nil, forEvent event: UIControl.Event = .touchUpInside, action: (() -> Void)? = nil )Parameters
titleText used for the button’s title
titleColorColor used for the title’s font (Default: nil)
backgroundColorColor used for the button’s background color (Default: nil)
forEventUIControl event for when to fire action (Default: .touchUpInside)
actionClosure for the the button’s action (Default: nil)
-
Creates a UIButton with a label view
Declaration
Swift
public init( forEvent event: UIControl.Event = .touchUpInside, action: (() -> Void)? = nil, labelView: () -> UIView )Parameters
forEventUIControl event for when to fire action (Default: .touchUpInside)
actionClosure for the the button’s action
labelViewThe view to embed
-
Update the button’s action
Declaration
Swift
@discardableResult public func setAction(_ action: (() -> Void)?) -> Self
View on GitHub
Button Class Reference