June 2011
Intermediate to advanced
590 pages
19h 31m
English
A layer is simply a bitmap, and its contents can be set programmatically or with an image. To set the contents programmatically, you either subclass CALayer or assign a delegate to an instance of CALayer. The delegate then implements drawing routines. (This is how implicit layers work; the view is its layer’s delegate.)
We will discuss drawing to a layer programmatically at the end of this chapter. For now, you’re going to set the contents of the layer using an image file.
In HypnosisView.m, add the following code to the initWithFrame: method:
- (id)initWithFrame:(CGRect)r { self = [super initWithFrame:r]; if (self) { stripeColor ...Read now
Unlock full access