Описание тега cagradientlayer
CAGradientLayer
is a special purpose CALayer
subclass for drawing animatable linear gradients. It's a part of the quartz-core framework and is available for both ios (since iOS 3.0) and osx (since OS X v10.6 "Snow Leopard").
The gradient is specified using four properties for the colors
, their locations
and the startPoint
and endPoint
of the layer. All four properties are animatable.
The colors
is an NSArray
of CGColorRef
objects therefore they need to be cast to id
s when adding them to the array.
The locations
, startPoint
and endPoint
are specified in the unit coordinate space of the layers bounds. This means that the values go from 1.0 to 0.0. In both iOS and OS X, x increases to the right which means that 0.0 is the left edge and 1.0 is the right edge. On iOS y increases downward and on OS X y increases upwards.