Class

UIDocumentInteractionController

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

Declaration

@interface UIDocumentInteractionController : NSObject

Overview

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.

Topics

Creating the Document Interaction Controller

+ interactionControllerWithURL:

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

Handling Document-Related Interactions

delegate

The delegate you want to receive document interaction notifications.

UIDocumentInteractionControllerDelegate

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

URL

The URL identifying the target file on the local filesystem.

UTI

The type of the target file.

name

The name of the target file.

icons

The images associated with the target file.

annotation

Custom property list information for the target file.

Accessing the Controller Attributes

gestureRecognizers

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

Relationships

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 an App Based on the Document Browser View Controller

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

UIDocumentBrowserViewController

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

UIDocumentPickerViewController

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software