Platforms to show: All Mac Windows Linux Cross-Platform

CALayerMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class CoreAnimation MBS MacCG Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The plugin class for a CoreAnimation.
Example
// add gray layer over Xojo window. Or hide it on second call, show on third call, etc...

If view = Nil Then
// view is property in window/module

Dim win As NSWindowMBS = Self.NSWindowMBS

view = New NSViewMBS(0, 0, Width, Height)

win.contentView.AddSubView(view)

view.wantsLayer = True
view.autoresizesSubviews = True
view.autoresizingMask = view.NSViewWidthSizable + view.NSViewHeightSizable

Dim layer As CALayerMBS = view.layer
layer.backgroundColor = CGColorMBS.CreateDeviceGray(0.3, 0.5)

Else

// show or hide
view.isHidden = Not view.isHidden

End If

The CALayer class manages image-based content and allows you to perform animations on that content. Layers are often used to provide the backing store for views but can also be used without a view to display content. A layer's main job is to manage the visual content that you provide but the layer itself has visual attributes that can be set, such as a background color, border, and shadow. In addition to managing visual content, the layer also maintains information about the geometry of its content (such as its position, size, and transform) that is used to present that content onscreen. Modifying the properties of the layer is how you initiate animations on the layer's content or geometry. A layer object encapsulates the duration and pacing of a layer and its animations by adopting the CAMediaTiming protocol, which defines the layer's timing information.

If the layer object was created by a view, the view typically assigns itself as the layer's delegate automatically, and you should not change that relationship. For layers you create yourself, you can assign a delegate object and use that object to provide the contents of the layer dynamically and perform other tasks. A layer may also have a layout manager object (assigned to the layoutManager property) to manage the layout of subviews separately.

Available in OS X v10.5 and later.

Edge constants

Constant Value Description
kCALayerBottomEdge 4 Specifies that the bottom edge of the receiver's content should be antialiased.
kCALayerLeftEdge 1 Specifies that the left edge of the receiver's content should be antialiased.
kCALayerRightEdge 2 Specifies that the right edge of the receiver's content should be antialiased.
kCALayerTopEdge 8 Specifies that the top edge of the receiver's content should be antialiased.

Autoresize Mask Constants

Constant Value Description
kCALayerHeightSizable 16 The receiver's height is flexible.
kCALayerMaxXMargin 4 The left margin between the receiver and its superview is flexible.
kCALayerMaxYMargin 32 The top margin between the receiver and its superview is flexible.
kCALayerMinXMargin 1 The left margin between the receiver and its superview is flexible.
kCALayerMinYMargin 8 The top margin between the receiver and its superview is flexible.
kCALayerNotSizable 0 The receiver cannot be resized.
kCALayerWidthSizable 2 The receiver's width is flexible.

Sub classes:

Some methods using this class:

Some properties using for this class:

Some examples using this class:

Blog Entries

Release notes

  • Version 22.2
    • Corrected declaration of autoresizingMask in CALayerMBS to correctly state as not supported for iOS.
  • Version 21.4
    • Fixed problem with borderColor assignment in CALayerMBS class not working.

The items on this page are in the following plugins: MBS AVFoundation Plugin, MBS MacCG Plugin.


CalAttendeeMBS   -   CalCalendarItemMBS


The biggest plugin in space...