1

I want a file preview in application.
File is from web server (I have url of file.)
May can be any type. (image/audio/video/doc etc)

I want previewer like Finder previewer in Mac (by pressing space to any file in mac)

Amit Battan
  • 2,968
  • 2
  • 32
  • 68

3 Answers3

2

The easiest method, IMO, would be to simply use a UIWebView.

[self.webView loadRequest:[NSURLRequest requestWithURL:fileUrl]];

Where fileUrl is an NSURL pointing to the file's URL (remote or local). From my experience, UIWebViews are extremely capable of opening many different file types efficiently.

cscott530
  • 1,658
  • 16
  • 25
2

You should use UIDocumentInteractionController. You can look at the tutorial here for an example of how to use it:

http://mobile.tutsplus.com/tutorials/iphone/previewing-and-opening-documents-with-uidocumentinteractioncontroller/

gregschlom
  • 4,825
  • 4
  • 28
  • 23
0

The problem with UIWebView is that it has memory leaks that will cause your app to crash if you persistently preview images, you can check the behavior through instruments. I think the best way of doing so if you don't care about encryption is to use Quick Look Previewer. If you care about encryption, you can use UIImageView

Ahmed Ebaid
  • 417
  • 6
  • 21