Deprecated UIDocumentInteractionControllerDelegate Methods

A method identified as deprecated has been superseded and may become unsupported in the future.

Deprecated in iOS 6.0

documentInteractionController:canPerformAction:

Called when a document interaction controller needs to know whether the specified action can be performed on the associated document. (Deprecated in iOS 6.0.)

- (BOOL) documentInteractionController: (UIDocumentInteractionController *) controller canPerformAction: (SEL) action
Parameters
controller

The document interaction controller managing an associated document.

action

The selector representing the action in question.

Return Value

YES if the specified action is supported for the associated document or NO if it is not. If you do not implement this method, the return value is assumed to be NO.

Discussion

When building the options menu (invoked, for example, by the user performing a long press gesture), a document interaction controller calls this method to find out if your app can perform various actions. If you implement this method for a given action, you must also implement the documentInteractionController:performAction: method for that action.

The supported action selectors for this method are copy: and print:. (The print: selector is available in iOS 4.2 and later. Printing is supported only on devices that support multitasking.)

For each action that you implement in the documentInteractionController:performAction: delegate method, return YES from this method if that action is available for the document. For example, you could use code similar to the following to determine whether to include a Print item in the options menu:

if (action == @selector (print:) &&
      [UIPrintInteractionController canPrintURL: controller.URL]) {
   return YES;
} else {
   return NO;
}

In this if statement, the controller object is an instance of UIDocumentInteractionController and the URL property points to the associated document.

Availability
  • Available in iOS 3.2 and later.
  • Deprecated in iOS 6.0.
Declared In
UIDocumentInteractionController.h

documentInteractionController:performAction:

Called when a document interaction controller wants its delegate to perform a specified action with the associated document. (Deprecated in iOS 6.0.)

- (BOOL) documentInteractionController: (UIDocumentInteractionController *) controller performAction: (SEL) action
Parameters
controller

The document interaction controller managing an associated document.

action

The selector representing the action to perform. You can invoke this selector directly on the object responsible for performing the action or use it to call the appropriate method.

Return Value

YES if the action was performed successfully or NO if it was not.

Discussion

The supported action selectors for this method are copy: and print:. (The print: selector is available in iOS 4.2 and later. Printing is supported only on devices that support multitasking.)

To implement a copy: action, write the contents of the document—directly, or modified according to the intent of your app—to the pasteboard.

To implement a print: action, use the shared print interaction controller object. Assign the URL property of the document interaction controller to the print interaction controller’s printingItem property. Then present the printing user interface. For details, refer to UIPrintInteractionController Class Reference and to “Printing” in Drawing and Printing Guide for iOS.

Instead of implementing printing code in this method, you can rely on the built-in printing support of the Quick Look framework. For document types that can be previewed, the options menu of a document interaction controller always contains a Quick Look item. If the user chooses that item, the resulting Quick Look view includes an action button in the navigation bar that, when tapped, offers a Print button. In this case, the system automatically handles printing. For details, refer to QLPreviewController Class Reference and to “Using the Quick Look Framework” in Document Interaction Programming Topics for iOS.

Availability
  • Available in iOS 3.2 and later.
  • Deprecated in iOS 6.0.
Declared In
UIDocumentInteractionController.h