NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
[webView loadHTMLString:htmlString baseURL:baseURL];
With the correct base url, the images can be loaded relatively with:

Or in CSS
.someBG {
background: url(theImage.png);
}
Source: http://stackoverflow.com/questions/747407/using-html-and-local-images-within-uiwebview
Another way to load an image is to convert it to base64 in this post:
http://iphoneincubator.com/blog/windows-views/display-images-in-uiwebview
No comments:
Post a Comment