Chapter 16. Accessory Windows

When a Cocoa-based application starts up, it loads all of the objects in the main nib file, then initializes, connects, and displays them. This can take some time, and the more objects you have in your interface, the longer it will take. While this process is happening, nothing else can happen in your application, and the user gets to watch the application icon bounce.

To shorten load time, lower initial memory consumption, and help organize your application better, Cocoa lets you use multiple nib files and load them on demand. For example, you can have separate nib files for info panels, toolbars, and dialog boxes. This chapter shows you how to use auxiliary windows with your application, explaining how to load them and how to manipulate their contents to create inspectors.

The Role of File’s Owner

So far, we haven’t paid much attention to the special File’s Owner object that shows up in Interface Builder—other than to say that it is a proxy object that “owns” the objects in a nib file. However, when working with multiple nib files, it is crucial to understand the role that the File’s Owner plays as the object that loads—and thus “owns”—the nib file. When working with a single nib file, it is easy enough to create connections between your code and controls in the nib file. However, when working with multiple nib files, it becomes more difficult to make clear connections between controls in an auxiliary nib file and those of the main 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.