GradientView
public final class GradientView: UIView
A gradient view that acts as the background of any ColorSlider
.
This class draws colors based on the orientation
passed to the initializer
and determines the output color of ColorSlider
after a touch event.
Customize the appearance of ColorSlider by setting layer properties on
this class, including borderWidth
, borderColor
, and cornerRadius
.
-
Whether the gradient should adjust its corner radius based on its bounds. When
true
, the layer’s corner radius is set tomin(bounds.width, bounds.height) / 2.0
inlayoutSubviews
.Declaration
Swift
public var automaticallyAdjustsCornerRadius: Bool = true
-
The saturation of all colors in the view. Defaults to
1
.Declaration
Swift
public var saturation: CGFloat = 1
-
The percent of space at the beginning (top for orientation
.vertical
and left for orientation.horizontal
) end of the slider reserved for the color white. Defaults to0.15
.Declaration
Swift
public var whiteInset: CGFloat = 0.15
-
The percent of space at the end (bottom for orientation
.vertical
and right for orientation.horizontal
) end of the slider reserved for the color black. Defaults to0.15
.Declaration
Swift
public var blackInset: CGFloat = 0.15
-
Declaration
Swift
required public init(orientation: Orientation)
Parameters
orientation
The orientation of the gradient view.