April 2015
Intermediate to advanced
556 pages
17h 47m
English
When a sheet is active, the user is prevented from interacting with the window from which it is presented. Modal windows are similar, except that they are presented independently of the other windows and they block user input for the rest of the application.
To present a window modally, use the runModalForWindow(_:) method on NSApplication:
func showModalWindow() {
let windowController = CriticalWindowController()
let app = NSApplication.sharedApplication()
let returnCode = app.runModalForWindow(windowController.window!)
if returnCode == CriticalWindowController.returnAccept {
...
}
}
This method will block, and only events destined for the modal window will be processed; clicking on the menu and other windows ...
Read now
Unlock full access