O'Reilly logo

Learning Cocoa with Objective-C, 2nd Edition by James Duncan Davidson, 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

Chapter 10. Multiple Document Architecture

So far, our examples have centered on applications that have a single GUI. However, in reality many of the applications we use day-in and day-out—such as word processors and web browsers—are based around the idea of a document. They provide a framework for viewing or generating identically-contained, but uniquely-composed, sets of data that can be stored in files.

A document-based application must perform the following tasks:

  • Create new documents

  • Open existing documents stored in files

  • Save documents to user-designated files and locations

  • Revert to previously saved documents

  • Close documents, usually after prompting the user to save changes

  • Print documents and allow the page layout to be modified

  • Monitor and set the document’s edited status, as well as reflect that status to the user

  • Manage document windows, including setting window titles

Cocoa provides a multiple-document architecture, helping you take care of these tasks easily. Using this architecture drastically simplifies the work developers must do to implement a multidocument application. Once you understand how this architecture works, you can have a multidocument application up and running in minutes.

This chapter begins with an overview of Cocoa’s multiple-document architecture and then presents an in-depth look at the classes that make up this architecture. The final part of the chapter guides you through the process of creating a simple multiple-document text-editing application. ...

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