Instance Method


Controls the ordering of files presented by the NSSavePanel object specified.


- (NSComparisonResult)panel:(id)sender compareFilename:(NSString *)name1 with:(NSString *)name2 caseSensitive:(BOOL)caseSensitive;



Panel requesting the ordering.


String representing the first filename to order.


String representing the second filename to order.


If YES, the ordering is case-sensitive; if NO, it is not.

Return Value

One of the following:

  • NSOrderedAscending if fileName1 should precede fileName2

  • NSOrderedSame if the two names are equivalent

  • NSOrderedDescending if fileName2 should precede fileName1


Don’t reorder filenames in the Save panel without good reason, because it may confuse the user to have files in one Save panel or Open panel ordered differently than those in other such panels or in the Finder. The default behavior of Save and Open panels is to order files as they appear in the Finder. Note also that by implementing this method you will reduce the operating performance of the panel.

See Also

Running Panels

- beginSheetForDirectory:file:modalForWindow:modalDelegate:didEndSelector:contextInfo:

Presents a Save panel as a sheet with a specified path and, optionally, a specified file in that path.

- beginSheetModalForWindow:completionHandler:

Presents the panel as a sheet modal to the specified window.

- beginWithCompletionHandler:

Presents the panel as a modeless window.

- runModal

Displays the panel and begins its event loop with the current working (or last selected) directory as the default starting point.

- runModalForDirectory:file:

Initializes the panel to the directory and file specified, if any, then displays it and begins its modal event loop.

- panel:isValidFilename:

Gives the delegate the opportunity to validate selected items.

- validateVisibleColumns

Validates and possibly reloads the browser columns visible in the panel by invoking the delegate method panel:shouldShowFilename:.

- panel:shouldShowFilename:

Gives the delegate the opportunity to filter items that it doesn’t want the user to choose.

- panel:directoryDidChange:

Tells the delegate that the user has changed the selected directory in the NSSavePanel object specified.