Type Property

layerClass

Returns the class used to create the layer for instances of this class.

Declaration

@property(class, nonatomic, readonly) Class layerClass;

Return Value

The class used to create the view’s Core Animation layer.

Discussion

This method returns the CALayer class object by default. Subclasses can override this method and return a different layer class as needed. For example, if your view uses tiling to display a large scrollable area, you might want to override this property and return the CATiledLayer class, as shown in Listing 1.

Listing 1

Returning a tiled layer

override class var layerClass : AnyClass {
   return CATiledLayer.self}

This method is called only once early in the creation of the view in order to create the corresponding layer object.

See Also

Configuring a View’s Visual Appearance

backgroundColor

The view’s background color.

hidden

A Boolean value that determines whether the view is hidden.

alpha

The view’s alpha value.

opaque

A Boolean value that determines whether the view is opaque.

tintColor

The first nondefault tint color value in the view’s hierarchy, ascending from and starting with the view itself.

tintAdjustmentMode

The first non-default tint adjustment mode value in the view’s hierarchy, ascending from and starting with the view itself.

clipsToBounds

A Boolean value that determines whether subviews are confined to the bounds of the view.

clearsContextBeforeDrawing

A Boolean value that determines whether the view’s bounds should be automatically cleared before drawing.

maskView

An optional view whose alpha channel is used to mask a view’s content.

layer

The view’s Core Animation layer used for rendering.