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 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.