Modals and Sheets

So far, you have seen APIs for using NSAlert to show a panel modally. When runModal() is called, it blocks until the user dismisses the alert. While the modal alert is being shown it is the only window receiving events; all other windows in the application will be unusable. As a result, when a panel is run modally, users will not be able to use the rest of the application until they have responded to the alert panel. Modal alerts are convenient to show but should be used sparingly for this reason.

Alerts can also be run as a sheet on top of another window (shown in Figure 15.5). This indicates to the user that the alert (or content of the sheet) is related to that window. Similar to running an alert panel modally, ...

Get Cocoa Programming for OS X: The Big Nerd Ranch Guide 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.