Contents

setColors:atLocations:

Sets the colors and corresponding unit distance values to create gradients.

Declaration

- (void) setColors:(NSArray<UIColor *> *) colors atLocations:(NSArray<NSNumber *> *) locations;
- (void) setColors:(NSArray<NSColor *> *) colors atLocations:(NSArray<NSNumber *> *) locations;

Parameters

  • colors:

    An array of colors making up the transition points of the gradient.

  • locations:

    An array of unit distance values that correspond to the provided colors.

Discussion

The unit distance value of 0 represents the start of the polyline, and 1 represents the end of the polyline. A gradient may have any number of steps along the length of the polyline.

To determine a location along the polyline, use location(atPointIndex:), or retrieve a set of locations using locationsAtPointIndexes:.

See Also

Accessing the gradient colors