iOS Guides | Samples

MonoTouch.CoreAnimation.CAGradientLayer Class

Layer that renders a gradient over its background.

See Also: CAGradientLayer


[MonoTouch.Foundation.Register("CAGradientLayer", true)]
public class CAGradientLayer : CALayer


When you want to use one of the CALayer subclasses as your UIView's backing layer, you need to add the following code snippet to your class:

C# Example

class MyView : UIView {
    // This instructs the runtime that whenever a MyView is created
    // that it should instantiate a CAGradientLayer and assign that to the
    // UIView.Layer property
    [Export ("layerClass")]
    public static Class LayerClass () {
        return new Class (typeof (CAGradientLayer));

Related content


Namespace: MonoTouch.CoreAnimation
Assembly: monotouch (in monotouch.dll)
Assembly Versions:

The members of MonoTouch.CoreAnimation.CAGradientLayer are listed below.

See Also: CALayer

Public Constructors

Default constructor that initializes a new instance of this class with no parameters.
A constructor that initializes the object from the data stored in the unarchiver object.
Constructor to call on derived classes to skip initialization and merely allocate the object.
A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

Public Properties

ClassHandleIntPtr. The handle for this class.
ColorsCGColor[]. An array of colors defining the gradient. These values can be animated.
EndPointPointF. The end point for the gradient. This property can be animated.
GradientLayerAxialNSString. Represents the value associated with the constant kCAGradientLayerAxial
LocationsNSNumber[]. Optional array of NSNumbers that describe the position of each gradient stop. This property can be animated.
StartPointPointF. Starting point for the gradient.
TypeString. The gradient type displayed, you can set it to GradientLayerDisplay.

Public Methods