iOS Developer Library — Pre-Release

Developer

UIKit Framework Reference UIDocumentMenuViewController Class Reference

Options
Deployment Target:

On This Page
Language:

UIDocumentMenuViewController

A UIDocumentMenuViewController object represents a list of all the available document providers for a given file type and mode. You can also add your own custom menu items to this list.

Inheritance


Import Statement


Swift

import UIKit

Objective-C

@import UIKit;

Availability


Available in iOS 8.0 and later.
  • Initializes and returns a document menu to import or open the given file types.

    Declaration

    Swift

    init!(documentTypes allowedUTIs: [AnyObject], inMode mode: UIDocumentPickerMode)

    Objective-C

    - (instancetype)initWithDocumentTypes:(NSArray *)allowedUTIs inMode:(UIDocumentPickerMode)mode

    Parameters

    allowedUTIs

    An array of uniform type identifiers. UTIs are strings that uniquely identify a file’s type. For more information, see Uniform Type Identifiers Overview.

    mode

    The type of file transfer operation the document picker performs. This argument accepts only the UIDocumentPickerModeImport or UIDocumentPickerModeOpen mode.

    Return Value

    Returns an initialized UIDocumentMenuViewController object, or nil if the object could not be successfully initialized.

    Discussion

    The UTI array defines the type of documents that can be imported or opened. The resulting document menu displays all the document pickers appropriate for the given document types and mode.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 8.0 and later.

  • init(URL:inMode:) - initWithURL:inMode: Designated Initializer

    Initializes and returns a document menu to export or move the given document.

    Declaration

    Swift

    init!(URL url: NSURL, inMode mode: UIDocumentPickerMode)

    Objective-C

    - (instancetype)initWithURL:(NSURL *)url inMode:(UIDocumentPickerMode)mode

    Parameters

    url

    The document to be exported or moved.

    mode

    The type of file-transfer operation that the document picker performs. This argument accepts only the UIDocumentPickerModeExportToService or UIDocumentPickerModeMoveToService mode.

    Return Value

    Returns an initialized UIDocumentMenuViewController object, or nil if the object could not be successfully initialized.

    Discussion

    The resulting document menu displays all the document pickers appropriate for the given mode.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 8.0 and later.

  • The insertion point for custom menu items.

    Declaration

    Swift

    enum UIDocumentMenuOrder : UInt { case First case Last }

    Objective-C

    typedef NS_ENUM (NSUInteger, UIDocumentMenuOrder ) { UIDocumentMenuOrderFirst, UIDocumentMenuOrderLast }

    Constants

    • First

      UIDocumentMenuOrderFirst

      The top item in the document menu.

      Available in iOS 8.0 and later.

    • Last

      UIDocumentMenuOrderLast

      The bottom item in the document menu.

      Available in iOS 8.0 and later.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 8.0 and later.