Instance Method


Invalidates the layer’s layout and marks it as needing an update.


- (void)setNeedsLayout;


You can call this method to indicate that the layout of a layer’s sublayers has changed and must be updated. The system typically calls this method automatically when the layer’s bounds change or when sublayers are added or removed. In macOS, if your layer’s layoutManager property contains an object that implements the invalidateLayoutOfLayer: method, that method is called too.

During the next update cycle, the system calls the layoutSublayers method of any layers requiring layout updates.

See Also

Managing Layer Resizing and Layout


The object responsible for laying out the layer’s sublayers.

- layoutSublayers

Tells the layer to update its layout.

- layoutIfNeeded

Recalculate the receiver’s layout, if required.

- needsLayout

Returns a Boolean indicating whether the layer has been marked as needing a layout update.


A bitmask defining how the layer is resized when the bounds of its superlayer changes.

- resizeWithOldSuperlayerSize:

Informs the receiver that the size of its superlayer changed.

- resizeSublayersWithOldSize:

Informs the receiver’s sublayers that the receiver’s size has changed.

- preferredFrameSize

Returns the preferred size of the layer in the coordinate space of its superlayer.