Instance Property

masksToBounds

A Boolean indicating whether sublayers are clipped to the layer’s bounds. Animatable.

Declaration

var masksToBounds: Bool { get set }

Discussion

When the value of this property is true, Core Animation creates an implicit clipping mask that matches the bounds of the layer and includes any corner radius effects. If a value for the mask property is also specified, the two masks are multiplied to get the final mask value.

The default value of this property is false.

See Also

Modifying the Layer’s Appearance

var contentsGravity: CALayerContentsGravity

A constant that specifies how the layer's contents are positioned or scaled within its bounds.

Contents Gravity Values

The contents gravity constants specify the position of the content object when the layer bounds is larger than the bounds of the content object. They are used by the contentsGravity property.

var opacity: Float

The opacity of the receiver. Animatable.

var isHidden: Bool

A Boolean indicating whether the layer is displayed. Animatable.

var mask: CALayer?

An optional layer whose alpha channel is used to mask the layer’s content.

var isDoubleSided: Bool

A Boolean indicating whether the layer displays its content when facing away from the viewer. Animatable.

var cornerRadius: CGFloat

The radius to use when drawing rounded corners for the layer’s background. Animatable.

var borderWidth: CGFloat

The width of the layer’s border. Animatable.

var borderColor: CGColor?

The color of the layer’s border. Animatable.

var backgroundColor: CGColor?

The background color of the receiver. Animatable.

var shadowOpacity: Float

The opacity of the layer’s shadow. Animatable.

var shadowRadius: CGFloat

The blur radius (in points) used to render the layer’s shadow. Animatable.

var shadowOffset: CGSize

The offset (in points) of the layer’s shadow. Animatable.

var shadowColor: CGColor?

The color of the layer’s shadow. Animatable.

var shadowPath: CGPath?

The shape of the layer’s shadow. Animatable.

var style: [AnyHashable : Any]?

An optional dictionary used to store property values that aren't explicitly defined by the layer.

var allowsEdgeAntialiasing: Bool

A Boolean indicating whether the layer is allowed to perform edge antialiasing.

var allowsGroupOpacity: Bool

A Boolean indicating whether the layer is allowed to composite itself as a group separate from its parent.