Modal Loops

A modal loop is a loop that consumes all events so that it is not possible for the user to interact normally with an application until the modal loop terminates. Modal loops are used when the user’s attention is required before the application can continue processing. For example, modal loops are used when the user must acknowledge an error message before continuing or when input is required.

Modal loops consume all events in an application, but users can use other applications, move application windows, and hide applications even when modal loops are running.

Modal loops are started in two general ways: either an entire window is run in a modal loop controlled by the NSApplication class, or an individual view implements its own ...

Get Cocoa® Programming 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.