SKImageButton
open class SKImageButton : UIButton
SKImageButton is s subclass of UIButton where different states have the same image with a different customizable opacity.
-
The image to use for the button. Different state will use this image, with different assigned opacities.
Declaration
Swift
public var image: UIImage? { get set } -
Overriding the original method to update the button background when the button is highlighted.
Declaration
Swift
open override var isHighlighted: Bool { get set } -
Overriding the original method to update the button background when the button is enabled.
Declaration
Swift
open override var isEnabled: Bool { get set } -
Overriding the original method to update the button background when the button is selected.
Declaration
Swift
open override var isSelected: Bool { get set }
-
initvia code.Declaration
Swift
public override init(frame: CGRect) -
initvia IB.Declaration
Swift
public required init?(coder aDecoder: NSCoder)
-
Sets the opacity of a given state.
Declaration
Swift
public func setOpacity(_ opacity: CGFloat, for state: UIControl.State)Parameters
opacityThe desired opacity.
stateThe button state to modify.
-
Checks the opacity of a given state.
Declaration
Swift
public func getOpacity(for state: UIControl.State) -> CGFloat?Parameters
stateThe button state.
Return Value
The opacity of that state if assigned, otherwise nil.
-
The opacity of a given state. This does not reflect the opacity assigned to that state, but rather the opacity that will show up, since if no opacity is assigned it fallsback to
.normalstate.Declaration
Swift
public func opacity(for state: UIControl.State) -> CGFloatParameters
stateThe state of the button.
Return Value
The opacity that will appear given that state.
View on GitHub
SKImageButton Class Reference