NSWindow offers a set of notifications related to sheets, which it broadcasts on occurrences of a sheet opening or closing. Each notification is matched to a delegate method, so an NSWindow’s delegate is automatically registered for all notifications that it implements methods for.
NSWindowWillBeginSheetNotification is sent before a sheet is presented on a window and
NSWindowDidEndSheetNotification after it is dismissed.
A window delegate should implement the following methods to receive the appropriate sheet notification:
- (void)windowWillBeginSheet:(NSNotification *)notification;
- (void)windowDidEndSheet:(NSNotification *)notification;
It is important to note that a window’s delegate is not the same as the modal delegate specified as a parameter in the
NSBegin...Alert calls. The modal delegate passed into the
NSBegin...Alert calls is a delegate relationship that exists only until the sheet is dismissed.