O'Reilly logo

The Complete Idiot's Guide® To iPad and iPhone App Development by Troy Brant

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

Classes in Objective-C

All Objective-C classes are split into two files: the interface and the implementation. The interface is where you declare your class and the instance variables it will contain. The interface is also where you declare all the public methods the class will present to the world. You only include the method header, not its body, in the interface.
The implementation, on the other hand, is where you write the methods you declared in the interface. You can also define private methods in the implementation file, simply by not including those method headers in the public interface file.

Interface

Let’s look at an example. Here is the Shape.h interface file for a simple Shape class:
Let’s break it down line by line:
Here, ...

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