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. ...
Get Learning Cocoa with Objective-C, 2nd Edition 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.