简体   繁体   中英

How can I use QLPreviewController in iOS to display image or file using http address?

I' m trying to use QLPreviewController to display files located in the web by http address. For example I want it to display image located here: http://iosdevelopertips.com/wp-content/uploads/2011/05/preview.jpg

In previewItemAtIndex I did this:

NSString* url = @"http://iosdevelopertips.com/wp-content/uploads/2011/05/preview.jpg";
return [NSURL URLWithString: url];

But when I click on the image in my tableview it appears Loading... indicator of the QLPreviewController which is rotating endlessly and in the log I see this message: Couldn't issue file extension for path: /wp-content/uploads/2011/05/preview.jpg

So the question how can I display files in QLPreviewController located in the web using http address in NSURL ? What am I doing wrong? Thanks.

You need to download the items yourself and then pass file URLs to the preview controller. The preview controller only deals with the display and user interaction for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM