After some digging, I found that the QLPreviewController uses the UIWebView under it and calls loadRequest: to load the requested file.
Another way to accomplish what you want is to make a private category on the UIWebView , and use the swizzling method to override the loadRequest: method and instead call the loadData:MIMEType:textEncodingName:baseURL: method.
Beware :
1) In scenarios with low memory (that is, large files), a black screen appears with a โError loading documentโ message if this bothers you. (The unhacked QLPreviewController knows how to handle these scripts very well and present a document.)
2) I'm not sure that Apple is going to approve this type of hack, although private APIs are not used here.
the code:
@implementation UIWebView (QLHack) - (void)MyloadRequest:(NSURLRequest *)request {
source share