Class

NSOpenPanel

The Open panel for the Cocoa user interface.

Overview

Apps use the Open panel as a convenient way to query the user for the name of a file to open. In a sandboxed environment, Open panels are drawn in a separate process by the powerbox, not by AppKit itself. When the user chooses a file to open, macOS adds that file to the app’s sandbox.

Topics

Creating Panels

openPanel

Creates and returns a NSOpenPanel object.

Configuring Panels

canChooseFiles

A Boolean that indicates whether the panel allows the user to choose files to open.

canChooseDirectories

A Boolean that indicates whether the panel allows the user to choose directories to open.

resolvesAliases

A Boolean that indicates whether the panel resolves aliases.

allowsMultipleSelection

A Boolean that indicates whether the panel’s browser allows the user to open multiple files (and directories) at a time.

Accessing User Selection

URLs

An array containing the absolute paths of the selected files and directories as URLs.

Managing Ubiquitous Documents

canDownloadUbiquitousContents

A Boolean that controls how the panel responds to ubiquitous documents that aren't yet fully downloaded locally.

canResolveUbiquitousConflicts

A Boolean that controls how the panel responds to ubiquitous documents with conflicting versions.

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
runModalForDirectory:file:types:

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

Deprecated
runModalForTypes:

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

Deprecated

Instance Properties

Relationships

Inherits From

See Also

Open and Save Panels

NSSavePanel

A Save panel that you can run in a modal loop.

NSOpenSavePanelDelegate

A set of methods that a delegate of NSOpenPanel or NSSavePanel should implement.