O'Reilly logo

Learning Cocoa by Apple Computer Inc

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

Build the Application

In this section you’ll create the basic infrastructure of the To Do application. First, you’ll create an NSDocument subclass. Next, you’ll implement the data model class for the application and set up the basic user interface for To Do documents. Finally you’ll implement the set of methods the ToDoDocument class uses to accept, organize, display, and store entered data. When you’re finished with this chapter, the application will allow you to click a day on the calendar and enter a list of to-do items. In Chapter 13 and Chapter 14, you’ll expand on the work you do here to make To Do a full-fledged Mac OS X application.

Create the Project

Create a new Project Builder project named To Do using the Cocoa Document-based Application template as a project starting point.

Every Cocoa application project created with Project Builder has the same main function (in the file main.m). When users double-click an application or document icon in the Finder, main (the entry point) is called first; main, in turn, calls NSApplicationMain—and that’s all it does.

The NSApplicationMain function does what’s necessary to get a Cocoa application up and running—it responds to events, coordinates the activity of its objects, and so on. This function starts the network of objects in the application sending messages to one another. Specifically, NSApplicationMain:

  • Gets the application’s attributes, which are stored in the application wrapper as a property list. From this property ...

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