A view controller that previews, opens, or prints files whose file format cannot be handled directly by your app.


@interface UIDocumentInteractionController : NSObject


Use this class to present an appropriate user interface for previewing, opening, copying, or printing a specified file. For example, an email program might use this class to allow the user to preview attachments and open them in other apps.

After presenting its user interface, a document interaction controller handles all interactions needed to support file preview and menu display.

You can also use the delegate to participate in interactions occurring within the presented interface. For example, the delegate is notified when a file is about to be handed off to another application for opening. For a complete description of the methods you can implement in your delegate, see UIDocumentInteractionControllerDelegate.


Creating the Document Interaction Controller

+ interactionControllerWithURL:

Creates and returns a new UIDocumentInteractionController object initialized with the specified URL.

Handling Document-Related Interactions


The delegate you want to receive document interaction notifications.


A set of methods you can implement to respond to messages from a document interaction controller.

Presenting and Dismissing a Document Preview

- presentPreviewAnimated:

Displays a full-screen preview of the target document.

- dismissPreviewAnimated:

Dismisses the currently active document preview.

Presenting and Dismissing Menus

- presentOptionsMenuFromRect:inView:animated:

Displays an options menu and anchors it to the specified location in the view.

- presentOptionsMenuFromBarButtonItem:animated:

Displays an options menu and anchors it to the specified bar button item.

- presentOpenInMenuFromRect:inView:animated:

Displays a menu for opening the document and anchors that menu to the specified view.

- presentOpenInMenuFromBarButtonItem:animated:

Displays a menu for opening the document and anchors that menu to the specified bar button item.

- dismissMenuAnimated:

Dismisses the currently active menu.

Accessing the Target Document’s Attributes


The URL identifying the target file on the local filesystem.


The type of the target file.


The name of the target file.


The images associated with the target file.


Custom property list information for the target file.

Accessing the Controller Attributes


The system-supplied gesture recognizers for presenting a document interaction controller.


Inherits From

See Also

Documents and Directories

Adding a Document Browser to Your App

Give users access to their local or remote documents from within your app.

Providing Access to Directories

Use a document picker to access the content of a directory outside your app’s container.

Building a Document Browser-Based App

Use a document browser to provide access to the user’s text files.

Building a Document Browser App for Custom File Formats

Implement a custom document file format to manage user interactions with files on different cloud storage providers.


A view controller for browsing and performing actions on documents stored locally and in the cloud.


A view controller that provides access to documents or destinations outside your app’s sandbox.