Subclassing UIView

To create a UIView subclass, select FileNewFile... (or press Command-N). From the iOS section, select Cocoa Touch and then choose Objective-C class (Figure 4.5).

Figure 4.5  Creating a new class

Creating a new class

Click Next. On the next pane, name the class BNRHypnosisView and select UIView as the superclass.

Figure 4.6  Choosing UIView as the superclass

Choosing UIView as the superclass

Click Next. Make sure that Hypnosister is checked beside Targets and then click Create.

Before writing the concentric circle drawing code for BNRHypnosisView ...

Get iOS Programming: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.