Chapter 1. Objective-C and Cocoa
This chapter presents the main features of the Objective-C language under the Cocoa environment. The organization of this chapter is as follows. In Section 1.1, we introduce the main concepts behind classes in Objective-C. In that section, you will learn how to declare a new class, define it, and use it from within other classes. You will also be exposed to important Cocoa classes and data types.
After that, you will learn in Section 1.2 about memory management in the iPhone OS. You will learn about how to create new objects as well as how to deallocate them, and you will also learn about your responsibility when obtaining objects from Cocoa frameworks or other frameworks.
Section 1.3 introduces the topic of Objective-C protocols. You will learn how to adopt protocols and how to declare new ones as well. You will learn in Section 1.4 about properties, an Objective-C language feature that allows you to access instance variables using the dot notation. The concept of categories is the subject of Section 1.5. These allow you to extend existing classes by adding new methods. Posing is another technique that is slightly different from categories. Posing allows you to replace a given class with one of its descendants. This is discussed in Section 1.6.
Exceptions and error handling are important features in any modern language. Section 1.7 covers both of these techniques and shows you the appropriate use of each feature. After covering exceptions and errors ...
Get iPhone SDK Programming: Developing Mobile Applications for Apple iPhone and iPod touch 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.