Deprecated NSSavePanel Methods
A method identified as deprecated has been superseded and may become unsupported in the future.
Deprecated in OS X v10.3
Deprecated in OS X v10.6
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. (Deprecated in OS X v10.6. Use beginSheetModalForWindow:completionHandler: instead.)
Parameters
- path
Directory whose files the panel displays. When
nil, the directory is the same directory used in the previous invocation of the panel; this is probably the best choice for most situations.- name
Specifies a particular file in path that is selected when the Save panel is presented to a user. When
nil, no file is initially selected.- docWindow
If not
nil, the Save panel slides down as a sheet running as a document modal window in docWindow. Ifnil, the behavior defaults to a standalone modal window.- modalDelegate
This is not the same as a delegate assigned to the panel. This delegate is temporary and the relationship only lasts until the panel is dismissed. The
NSSavePanelobject has a weak reference to the modal delegate.- didEndSelector
Message sent to modalDelegate after the modal session has ended, but before dismissing the Save panel. didEndSelector may dismiss the Save panel itself; otherwise, it is dismissed on return from the method. The corresponding method should have the following signature:
- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
The value passed as returnCode is either
NSCancelButtonorNSOKButton.- contextInfo
Context information passed to modalDelegate in the didEndSelector message.
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.6.
Declared In
NSSavePanel.hdirectory
Returns the absolute pathname of the directory currently shown in the panel. (Deprecated in OS X v10.6. Use directoryURL instead.)
Return Value
The absolute pathname of the directory currently shown in the panel.
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.6.
See Also
Declared In
NSSavePanel.hfilename
Returns the absolute pathname of the file currently shown in the panel. (Deprecated in OS X v10.6. Use URL instead.)
Return Value
The absolute pathname of the file.
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.6.
See Also
Declared In
NSSavePanel.hrequiredFileType
Returns the required file type (if any). (Deprecated in OS X v10.6. Use allowedFileTypes instead.)
Return Value
The required file type (if any).
Discussion
A file specified in the Save panel is saved with the designated filename and this file type as an extension. Examples of common file types are “rtf”, “tiff”, and “ps”. File type strings encoding HFS file types are not valid values for this attribute. An nil return value indicates that the user can save to any ASCII file.
This method is equivalent to calling allowedFileTypes and returning the first element of the list of allowed types, or nil if there are none.
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.6.
See Also
Declared In
NSSavePanel.hrunModalForDirectory:file:
Initializes the panel to the directory and file specified, if any, then displays it and begins its modal event loop. (Deprecated in OS X v10.6. Use runModal instead.)
Parameters
- path
Directory whose files the panel displays. When
nil, the directory is the same directory used in the previous invocation of the panel; this is probably the best choice for most situations.- filename
Specifies a particular file in path that is selected when the Save panel is presented to a user. When
nil, no file is initially selected.
Return Value
NSFileHandlingPanelOKButton (if the user clicks the OK button) or NSFileHandlingPanelCancelButton (if the user clicks the Cancel button).
Discussion
This method invokes NSApplication’s runModalForWindow: method with self as the argument.
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.6.
See Also
-
– runModal -
runModalForWindow:(NSApplication)
Declared In
NSSavePanel.hsetDirectory:
Sets the current pathname in the panel’s browser. (Deprecated in OS X v10.6. Use setDirectoryURL: instead.)
Parameters
- path
String to set as the panel’s current pathname.
Discussion
The path argument must be an absolute pathname.
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.6.
See Also
Declared In
NSSavePanel.hsetRequiredFileType:
Specifies the file type (as an extension) or a UTI. (Deprecated in OS X v10.6. Use setAllowedFileTypes: instead.)
Parameters
- type
String to set as the extension to be appended to any selected files that don’t already have that extension.
Discussion
If type is an extension, it should not include the period that begins the extension. Pass nil to indicate any type. File type strings encoding HFS file types are not valid values for this attribute. You need to invoke this method each time the Save panel is used for another file type within the application.
This method is equivalent to calling setAllowedFileTypes: with an array containing only type (unless type is nil, and then it’s equivalent to calling setAllowedFileTypes: with nil).
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.6.
See Also
Declared In
NSSavePanel.hpanel:compareFilename:with:caseSensitive:
Controls the ordering of files presented by the NSSavePanel object specified. (Deprecated in OS X v10.6. There is no replacement.)
Parameters
- sender
Panel requesting the ordering.
- fileName1
String representing the first filename to order.
- fileName2
String representing the second filename to order.
- flag
If
YES, the ordering is case-sensitive; ifNO, it is not.
Return Value
One of the following:
NSOrderedAscendingif fileName1 should precede fileName2NSOrderedSameif the two names are equivalentNSOrderedDescendingif fileName2 should precede fileName1
Discussion
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.
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.6.
Declared In
NSSavePanel.hpanel:directoryDidChange:
Tells the delegate that the user has changed the selected directory in the NSSavePanel object specified. (Deprecated in OS X v10.6. Use panel:didChangeToDirectoryURL: (NSOpenSavePanelDelegate) instead.)
Parameters
- sender
Panel whose directory has changed.
- path
String representing the new directory’s path.
Availability
- Available in OS X v10.3 and later.
- Deprecated in OS X v10.6.
See Also
-
panel:didChangeToDirectoryURL:(NSOpenSavePanelDelegate)
Declared In
NSSavePanel.hpanel:isValidFilename:
Gives the delegate the opportunity to validate selected items. (Deprecated in OS X v10.6. Use panel:validateURL:error: (NSOpenSavePanelDelegate) instead. If both methods are implemented, the URL version will be called.)
Parameters
- sender
Panel requesting filename validation.
- filename
String representing the filename to validate.
Return Value
YES if the filename is valid, or NO if the save panel should stay in its modal loop and wait for the user to type in or select a different filename or names.
Discussion
The NSSavePanel object sender sends this message just before the end of a modal session for each filename displayed or selected (including filenames in multiple selections). If the delegate refuses a filename in a multiple selection, none of the filenames in the selection is accepted.
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.6.
See Also
-
panel:validateURL:error:(NSOpenSavePanelDelegate)
Declared In
NSSavePanel.hpanel:shouldShowFilename:
Gives the delegate the opportunity to filter items that it doesn’t want the user to choose. (Deprecated in OS X v10.6. Use panel:shouldEnableURL: (NSOpenSavePanelDelegate).)
Parameters
- sender
Panel that is querying whether it should show a certain file.
- filename
String representing the name of the file to be loaded in the browser.
Return Value
YES if filename should be selectable, and NO if the save panel should disable the file or directory.
Discussion
The NSSavePanel object sender sends this message to the panel’s delegate for each file or directory (filename) it is about to load in the browser.
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.6.
See Also
-
panel:shouldEnableURL:(NSOpenSavePanelDelegate).
Declared In
NSSavePanel.h© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-02-16)