Implementing Quick Look

Implementing Quick Look requires just a few simple steps:

1. Declare the QLPreviewControllerDataSource protocol in your primary controller class.

2. Implement the numberOfPreviewItemsInPreviewController: and preview-Controller:previewItemAtIndex: data source methods. The first of these methods returns a count of items to preview. The second returns the preview item referred to by the index.

3. Ensure that preview items conform to the QLPreviewItem protocol. This protocol consists of two required properties: a preview title and an item URL. Recipe 11-5 creates a conforming QuickItem class. This class implements an absolutely minimal approach to support the data source.

Once these requirements are met, your code is ready ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.