Instance Method

runModalForDirectory:file:types:

Displays the panel and begins a modal event loop that is terminated when the user clicks either OK or Cancel.

Declaration

- (NSInteger)runModalForDirectory:(NSString *)path file:(NSString *)name types:(NSArray *)fileTypes;

Parameters

absoluteDirectoryPath

The 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 absoluteDirectoryPath that is selected when the Open panel is presented to the user. When nil, no file is initially selected.

fileTypes

An array of file extensions and/or HFS file types. Specifies the files the panel allows the user to select. nil makes all files in absoluteDirectoryPath selectable by the user. An array of types passed in here will override one set using allowedFileTypes.

Return Value

The button clicked to dismiss the dialog: NSOKButton for the OK button and NSCancelButton for the Cancel button.

Discussion

You can control whether directories and files appear in the browser with the canChooseDirectories and canChooseFiles methods.

See Also

Deprecated

filenames

Returns an array containing the absolute paths (as NSString objects) of the selected files and directories.

Deprecated
beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:

Presents an Open panel as a sheet with the directory specified by absoluteDirectoryPath and optionally the file specified by filename selected.

Deprecated
runModalForTypes:

Displays the panel and begins a modal event loop that is terminated when the user clicks either OK or Cancel.

Deprecated