O'Reilly logo

Xcode 7 Essentials - Second Edition by Jayant Varma, Brett Ohland

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

The basics

In our previous chapters on Interface Builder and creating controllers and view objects, you learned about subclassing. To reiterate, subclassing is a way of inheriting and extending a class to add new functionality. In iOS, every object that appears on the screen is a subclass of a base UIView class (in OS X, the base class is NSView). We subclass UIView because this class has all of the basic functionality that we need in order to show something on the screen and allow user interaction.

Any Custom Control that you create will need to subclass UIView as well.

Starting an example project

To begin, let's create our example Xcode project. Go to File | New | Project and create a new Single View Application in Xcode, cab be called as CustomControlsExample ...

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