Quick Look for iOS

3,899 views

Published on

Ever wanted to preview files like Apple's Mail app does? Quick Look is an Apple framework that lets you do just that.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,899
On SlideShare
0
From Embeds
0
Number of Embeds
34
Actions
Shares
0
Downloads
17
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Quick Look for iOS

    1. 1. Quick Look for iOSBy Robert Brown@robby_brown
    2. 2. What is Quick Look?Previews all common filesIncludes AirPrintAvailable since iOS 4.0
    3. 3. QLPreviewItemProtocol for previewing files(Required) -(NSURL)previewItemURL Must be a file URL (i.e. file://somefile.txt) Use [NSURL fileURLWithPath:somePath](Optional) -(NSString)previewItemTitleNSURL conforms to QLPreviewItem
    4. 4. QLPreviewControllerSubclass of UIViewControllerCan be pushed into view or presented modallyMust have a data sourceMay have a delegate
    5. 5. QLPreviewControlleriWork Documents Text files (with supported UTI)Microsoft OfficeDocuments (1997+) CSVRTF HTMLPDFImages
    6. 6. QLPreviewControllerDataSource Similar to UITableViewDataSource Tells how many QLPreviewItems it provides Returns a QLPreviewItem when asked
    7. 7. QLPreviewControllerDelegate Provides call backs for when the view will dismiss and did dismiss Provides a couple animation call backs One call back asking permission to open URLs
    8. 8. UIDocumentInteractionController Manages user interactions with files on the local system More control than QLPreviewController Only previews one file Provides easy access to a file’s icons Provides access to annotation property for passing custom data with a file
    9. 9. Inter-app File Sharing Files aren’t “shared,” they are copied into the app’s sandbox (~Documents/Inbox) An app’s Info.plist specifies which files are accepted with the CFBundleDocumentTypes key CFBundleDocumentTypes is an array of dictionaries
    10. 10. Inter-app File Sharing CFBundleDocumentTypes sub keys: CFBundleTypeName: Name of the type CFBundleTypeIconFiles: array of icons (smallest to largest) LSItemContentTypes: array of UTIs LSHandlerRank: Owner, Alternate, None, Default
    11. 11. Inter-app File Sharing LSHandlerRank (in order of precedence): Owner: Creator of these files Alternate: Secondary viewer None: Files can only be loaded through iTunes Default: Accepts files
    12. 12. Inter-app File Sharing Developer tip: Use mdls command on a file to see its UTI tree
    13. 13. Questions?
    14. 14. Demo
    15. 15. Want to learn more?robsprogramknowledge.blogspot.comDocument Interaction Programming Topics for iOSWWDC 2010 Session 106

    ×