Starts a modal event loop for the specified window.
- macOS 10.0+
The window to be displayed modally. If it is not already visible, the window is centered on the screen using the value in its
centermethod and made visible and key. If it is already visible, it is simply made key.
An integer indicating the reason that this method returned. See
NSModal possible return values.
This method runs a modal event loop for the specified window synchronously. It displays the specified window, makes it key, starts the run loop, and processes events for that window. (You do not need to show the window yourself.) While the app is in that loop, it does not respond to any other events (including mouse, keyboard, or window-close events) unless they are associated with the window. It also does not perform any tasks (such as firing timers) that are not associated with the modal run loop. In other words, this method consumes only enough CPU time to process events and dispatch them to the action methods associated with the modal window.
You can exit the modal loop by calling the
abort methods from your modal window code. If you use the
stop method to stop the modal event loop, this method returns the argument passed to
stop. If you use
stop instead, this method returns the constant
NSModal. If you use
abort, this method returns the constant