Another property is
locations. It is an array of floating-point values (boxed as NSNumber objects) defining the location of each gradient stop.
The gradient stops are specified as values between
1. The values must be monotonically increasing. You must ensure that the number of locations matches the number of colors or you’ll get a blank gradient. If
nil, the stops are spread uniformly across the range. Defaults to
This property is animatable, that means you can change the colors locations in an animated way.
And what about programming code?
What happens if we set the
[0.6, 0.3, 0.2] values as the
locations for the colors?
Please, don’t forget that the values must be monotonically increasing or you’ll get a wrong gradient.