iOS CAGradientLayer

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • CAGradientLayer() // Returns an initialized CALayer object.
  • CAGradientLayer(layer: layer) // Override to copy or initialize custom fields of the specified layer.

Parameters

ParameterDetails
colorAn array of CGColorRef objects defining the color of each gradient stop. Animatable.
locationsAn optional array of NSNumber objects defining the location of each gradient stop. Animatable.
endPointThe end point of the gradient when drawn in the layer’s coordinate space. Animatable.
startPointThe start point of the gradient when drawn in the layer’s coordinate space. Animatable.
typeStyle of gradient drawn by the layer. Defaults to kCAGradientLayerAxial.

Remarks

  • Use startPoint and endPoint to change the orientation of the CAGradientLayer.
  • Use the locations to affect the spread/positions of the colors.


Got any iOS Question?