Creating a CALayer
Not all layers are implicit layers. You can create a layer by sending alloc to the class CALayer. Layers created this way are called explicit layers. In this section, you’re going to create a layer and then make it a sublayer of the implicit layer of your HypnosisView (Figure 22.3).
Figure 22.3 Object diagram
In HypnosisView.h, import the QuartzCore framework and add an instance variable to hold on to the layer object you are about to create:
#import <Foundation/Foundation.h> #import <QuartzCore/QuartzCore.h> @interface HypnosisView : ...
Get iOS Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.