O'Reilly logo

iOS Programming: The Big Nerd Ranch Guide by Joe Conway, Aaron Hillegass

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

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:

#​i​m​p​o​r​t​ ​<​F​o​u​n​d​a​t​i​o​n​/​F​o​u​n​d​a​t​i​o​n​.​h​>​
#​i​m​p​o​r​t​ ​<​Q​u​a​r​t​z​C​o​r​e​/​Q​u​a​r​t​z​C​o​r​e​.​h​>​ @​i​n​t​e​r​f​a​c​e​ ​H​y​p​n​o​s​i​s​V​i​e​w​ ​:​ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required