Next Page > Hide TOC

CALayoutManager Protocol Reference

Framework
/System/Library/Frameworks/QuartzCore.framework
Declared in
CALayer.h
Companion guides

Overview

CALayoutManager is an informal protocol implemented by Core Animation layout managers. If a layer’s sublayers require custom layout you create a class that implements this protocol and set it as the layer’s layout manager using the CALayer method setLayoutManager:. Your custom layout manager is then used when the layer invokes setNeedsLayout or layoutSublayers.

Tasks

Layout Layers

Calculate Layer Size

Instance Methods

invalidateLayoutOfLayer:

Invalidates the layout of the specified layer.

- (void)invalidateLayoutOfLayer:(CALayer *)layer

Parameters
layer

The layer that requires layout.

Discussion

This method is called when the preferred size of the specified layer may have changed. The receiver should invalidate any cached state.

Availability
Declared In
CALayer.h

layoutSublayersOfLayer:

Layout each of the sublayers in the specified layer.

- (void)layoutSublayersOfLayer:(CALayer *)layer

Parameters
layer

The layer that requires layout of its sublayers.

Discussion

This method is called when the sublayers of the layer may need rearranging, and is typically called when a sublayer has changed its size. The receiver is responsible for changing the frame of each sublayer that requires layout.

Availability
Declared In
CALayer.h

preferredSizeOfLayer:

Returns the preferred size of the specified layer in its coordinate system.

- (CGSize)preferredSizeOfLayer:(CALayer *)layer

Parameters
layer

The layer that requires layout.

Return Value

The preferred size of the layer in the coordinate space of layer.

Discussion

This method is called when the preferred size of the specified layer may have changed. The receiver is responsible for recomputing the preferred size and returning it. If this method is not implemented the preferred size is assumed to be the size of the bounds of layer.

Availability
Declared In
CALayer.h

Next Page > Hide TOC


© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-07-24)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.