Class

QLPreviewController

A QLPreviewController object, or Quick Look preview controller, provides a specialized view for previewing an item. To display a Quick Look preview controller you have two options: You can push it into view using a UINavigationController object, or can present it modally, full screen, using the presentModalViewController:animated: method of its parent class, UIViewController.

Overview

A displayed preview includes a title taken from the last path component of the item URL. You can override this by implementing a previewItemTitle accessor for the preview item.

A Quick Look preview controller can display previews for the following items:

  • iWork documents

  • Microsoft Office documents (Office ‘97 and newer)

  • Rich Text Format (RTF) documents

  • PDF files

  • Images

  • Text files whose uniform type identifier (UTI) conforms to the public.text type (see Uniform Type Identifiers Reference)

  • Comma-separated value (csv) files

To use a Quick Look preview controller, you must provide a data source object. The data source provides preview items to the controller and tells it how many items to include in a preview navigation list. If there is more than one item in the list, a modally-presented (that is, full-screen) controller displays navigation arrows to let the user switch among the items. For a Quick Look preview controller pushed using a navigation controller, you can provide buttons in the navigation bar for moving through the navigation list.

For details on providing items to a preview controller, refer to QLPreviewControllerDataSource and QLPreviewItem Protocol Reference.

Symbols

Configuring a Quick Look Preview Controller

var dataSource: QLPreviewControllerDataSource?

The Quick Look preview controller’s data source.

var delegate: QLPreviewControllerDelegate?

The Quick Look preview controller’s delegate object.

Managing Item Previews

class func canPreview(QLPreviewItem)

Indicates whether or not the Quick Look preview controller can display an item.

var currentPreviewItem: QLPreviewItem?

The item currently displayed in the Quick Look preview controller.

var currentPreviewItemIndex: Int

The index, within the preview item navigation list, of the item currently displayed in the Quick Look preview controller.

func refreshCurrentPreviewItem()

Asks the Quick Look preview controller to recompute the display of the current preview item.

func reloadData()

Asks the Preview Controller to reload its data from its data source.