An object that provides an animated transition between a layer's states.
- iOS 2.0+
- macOS 10.5+
- tvOS 9.0+
You can transition between a layer's states by creating and adding a
CATransition object to it. The default transition is a cross fade, but you can specify different effects from a set of predefined transitions.
Listing 1 shows how you can transition between the two states of a
transitioning. When the layer is first created, its
background is set to red and its
string property is set to
Red. When the
run function is called, a new
CATransition object is created and added to
transitioning, and the state of the layer is changed so that its background color is blue and its rendered text reads
The end result is that the push transition animates the red state from left to right with the blue state entering the scene from the left.