Chapter 8. Objective-C/Cocoa Touch Fundamentals

Cocoa Touch is an extremely rich set of frameworks that define everything from handling strings to creating scrollable tables and sophisticated view navigation systems. This chapter focuses on the more mundane—but vitally important—parts of Cocoa Touch. You will use a variety of classes to manage temporary data in your app and pass it around from place to place. You will see some similarities between the Cocoa Touch ways of handling things and what you know from JavaScript. By the end of this chapter, I don’t expect you to have fully mastered all aspects of strings or data collections. But you will have examples that you can use as templates for your deployment of these items in your code until you are comfortable enough with them to rattle them off on your own. Before we get to those details, however, it’s time to get a better sense of how classes work and how to start thinking about your app’s requirements in terms of class structure.

More About Classes

In Chapter 4 and Chapter 5 you had a chance to see how important classes are to iOS programming (and most object-oriented programming). You will use classes in three basic ways within your code:

  1. Creating objects (instances of classes) for temporary processing

  2. Subclassing framework classes

  3. Defining your own custom classes

Each deployment style has its own requirements.

Temporary Objects

It is very common to use several Objective-C statements to assemble objects that eventually get passed as ...

Get Learning the iOS 4 SDK for JavaScript Programmers 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.