| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.0 and later. |
| Declared in | NSOpenPanel.h |
| Companion guides | |
| Related sample code |
The NSOpenPanel class provides the Open panel for the Cocoa user interface. Applications use the Open panel as a convenient way to query the user for the name of a file to open.
– canChooseFiles
– setCanChooseFiles:
– canChooseDirectories
– setCanChooseDirectories:
– resolvesAliases
– setResolvesAliases:
– allowsMultipleSelection
– setAllowsMultipleSelection:
– beginForDirectory:file:types:modelessDelegate:didEndSelector:contextInfo: Deprecated in Mac OS X v10.6
– beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo: Deprecated in Mac OS X v10.6
– runModalForDirectory:file:types: Deprecated in Mac OS X v10.6
– runModalForTypes: Deprecated in Mac OS X v10.6
– URLs
– filenames Deprecated in Mac OS X v10.6
Creates and returns a NSOpenPanel object.
+ (NSOpenPanel *)openPanel
The initialized Open panel.
NSOpenPanel.hReturns whether the panel’s browser allows the user to open multiple files (and directories) at a time.
- (BOOL)allowsMultipleSelection
YES if the panel’s browser allows multiple selection; otherwise, NO.
If multiple files or directories are allowed, then the filename method—inherited from NSSavePanel—returns a non-nil value only if one and only one file is selected. By contrast, NSOpenPanel’s URLs method always returns the URLs of the selected files, even if only one file is selected.
– URL (NSSavePanel)– URLs– setAllowsMultipleSelection:NSOpenPanel.hReturns whether the panel allows the user to choose directories to open.
- (BOOL)canChooseDirectories
YES if the panel allows the user to choose directories; otherwise, NO.
NSOpenPanel.hReturns whether the panel allows the user to choose files to open.
- (BOOL)canChooseFiles
YES if the panel allows the user to choose files; otherwise, NO.
NSOpenPanel.hReturns whether the panel resolves aliases.
- (BOOL)resolvesAliases
YES if the panel resolves aliases; otherwise, NO.
If YES, the effect is that dropping an alias on the panel or asking for filenames or URLs returns the resolved aliases. The default is YES.
NSOpenPanel.hSets whether the user can select multiple files (and directories) at one time for opening.
- (void)setAllowsMultipleSelection:(BOOL)flag
If YES, the panel’s browser allows multiple selection; if NO, it does not.
NSOpenPanel.hSets whether the user can select directories in the panel’s browser.
- (void)setCanChooseDirectories:(BOOL)flag
If YES, the panel allows the user to choose directories; if NO, it does not.
When a directory is selected, the OK button is enabled only if flag is YES.
NSOpenPanel.hSets whether the user can select files in the panel’s browser.
- (void)setCanChooseFiles:(BOOL)flag
If YES, the panel allows the user to choose files; if NO, it does not.
NSOpenPanel.hSets whether the panel resolves aliases.
- (void)setResolvesAliases:(BOOL)resolvesAliases
If YES, the panel resolves aliases; if NO, it does not.
If YES, the effect is that dropping an alias on the panel or asking for filenames or URLs returns the resolved aliases. Set this value to NO to allow selection of aliases without resolving.
NSOpenPanel.hReturns an array containing the absolute paths of the selected files and directories as URLs.
- (NSArray *)URLs
The array of URLs.
If multiple selections aren’t allowed, the array contains a single name.
NSOpenPanel.hLast updated: 2009-02-19