I'm trying to write code that loads a local html string into a UIWebView with images from the Assets.xcassets catalog.
Currently, I load the images from the main bundle, like this:
NSString *htmlString = [NSString stringWithFormat:@"<h1>My title</h1><img src='%@'/>", @"myImage1.png"];
[self.webView loadHTMLString:htmlString baseURL:[[NSBundle mainBundle] bundleURL]];
However, this is very limiting in respect to using different retina versions of the images (@2 and @3). I would like to load the images instead from the asset catalog, but can't figure out how to do it.
Provided the image name in the html string, how do I load the image from the assests into the webView, while supporting @2 and @3 retina versions?