For a well-documented feature, NSAlert
’s accessoryView
feature takes a little bit of fiddling to implement. NSAlert
is behind the standard pop-up modal alert window that’s familiar to everyone, often popping into the foreground and grabbing your attention, refusing to go away until you acknowledge its existence:
NSAlert
boxes can, by default, display any number of buttons (c.f. the classic “Save/Delete/Cancel” triumvirate), but advanced features require a little more jiggery-pokery. This mainly comes in the form of its accessoryView
property, which allows you to add an NSView
to the alert proper. At first you might be tempted to programatically create an NSView
, adding the required elements in init
methods and the like, but it turns out it’s actually a bit easier to use nib
files to hold all of that. This is how to do so.