RVS_MaskButton
@IBDesignable
open class RVS_MaskButton : UIButton
-
This allows you to set the font of the button. This is not inspectable, and must be set programmatically.
Declaration
Swift
var buttonFont: UIFont? { get set }
-
The starting color for the gradient. If not provided, the view backgroundColor is used. If that is not provided, then the view tintColor is used. If that is not provided, then the super (parent) view tintColor is used. If that is not provided, the AccentColor is used. If that is not provided, the class will not work.
Declaration
Swift
@IBInspectable var gradientStartColor: UIColor? { get set }
-
The ending color. If not provided, then the starting color is used.
Declaration
Swift
@IBInspectable var gradientEndColor: UIColor? { get set }
-
The angle of the gradient, in degrees. 0 (default) is top-to-bottom. Zero is top-to-bottom. Negative is counter-clockwise, and positive is clockwise.
Declaration
Swift
@IBInspectable var gradientAngleInDegrees: CGFloat { get set }
-
If true, then the label is reversed, so the background is “cut out” of the foreground. If there is a border, that will also be cut out.
Declaration
Swift
@IBInspectable var reversed: Bool { get set }
-
This allows access to the border width.
Declaration
Swift
@IBInspectable var borderWidthInDisplayUnits: CGFloat { get set }
-
This is used to flush the caches, and redraw the button.
Declaration
Swift
func forceRedraw()
-
We call this, when it’s time to lay out the control. We subvert the standard rendering, and replace it with our own rendering. Some of this comes from this SO answer
Declaration
Swift
override func layoutSubviews()
-
Called while tracking user touch. We use this to play with the alpha, while tracking.
Declaration
Swift
override func continueTracking(_ inTouch: UITouch, with inEvent: UIEvent?) -> Bool
Parameters
inTouch
The touch being tracked.
with
The event that spawned the touch.
Return Value
True, if the touch is to continue.
-
Called when ending user touch. We use this to restore the alpha.
Declaration
Swift
override func endTracking(_ inTouch: UITouch?, with inEvent: UIEvent?)
Parameters
inTouch
The touch being tracked.
with
The event that spawned the touch.
-
Called when setting text. We use this, to ensure we redraw the mask.
Declaration
Swift
override func setTitle(_ inTitle: String?, for inState: UIControl.State)
Parameters
inTitle
The new text.
for
The state, to which the text applies.
-
Called when setting images. We use this, to ensure we redraw the mask.
Declaration
Swift
override func setImage(_ inImage: UIImage?, for inState: UIControl.State)
Parameters
inImage
The new image. It should be a template image.
for
The state, to which the text applies.