I have a bunch of images stored in my database as blobs that I need to include in a UIWebView. I'd like to do this directly -- without first saving them as temp files. Is there a way to display images in UIWebView with raw data instead of a URL?
+2
A:
Use RFC 2397, the data URI scheme. Mark Kolich has a nice write-up for it in various contexts. He mostly is discussing CSS, but HTML is the same (and he gives an HTML example).
Rob Napier
2009-08-31 13:57:43
A:
I assume on the iPhone WebKit still loads URLs through the Cocoa URL loading system. If so, the best approach is for you to subclass NSURLProtocol and create your own custom scheme that loads data from your database. Bear in mind that this will be on a background thread, so watch out for thread safety.
Mike Abdullah
2009-09-06 13:41:16