2. The Backing Image
A picture is worth a thousand words. An interface is worth a thousand pictures.
Chapter 1, “The Layer Tree,” introduced the
CALayer class and created a simple layer with a blue background. Background colors are all very well, but layers would be rather boring if all they could display was a flat color. A
CALayer can actually contain a picture of anything you like. This chapter explores the backing image of
The contents Image
CALayer has a property called
contents. This property’s type is defined as
id, implying that it can be any kind of object. This is true—in the sense that you can assign any object you like to the
contents property and your app will still compile—however, in practice, if you supply ...