Graphics Reference
In-Depth Information
//add rounded corners and border
playerLayer.
masksToBounds
=
YES
;
playerLayer.
cornerRadius
=
20.0
;
playerLayer.
borderColor
= [
UIColor
redColor
].
CGColor
;
playerLayer.
borderWidth
=
5.0
;
//play the video
[player
play
];
}
Figure 6.17
AVPlayerLayer
rotated in 3D and displaying a border and corner radius
This chapter provided an overview of the many specialized layer types and the effects that
can be achieved by using them. We have only scratched the surface in many cases; classes
such as
CATiledLayer
or
CAEmitterLayer
could fill a chapter on their own.
However, the key point to remember is that
CALayer
is a jack-of-all-trades, and is not
optimized for every possible drawing scenario. To get the best performance out of Core
Animation, you need to choose the right tool for the job, and hopefully you have been
inspired to dig deeper into the various
CALayer
subclasses and their capabilities.