I display some html in my UIWebView and I have in my html references to images like: '/images/test1.gif' etc.
I display this in that way:
NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
[myWebView loadHTMLString:someHtml baseURL:baseURL];
I've also added all required images to my Xcode project, into 'images' directory. The problem is, that, as far as I can see, the baseUrl ends with '/', and path to the images starts with '/' (it's absolute). All that makes my images doesn't appear.
I've noticed, that if I change, in html, path to images, to for example 'images/test.gif', the image will show up, but I want (if possible) to avoid changing all image paths in html from absolute to relative, becasue this html is imported from some database, and in case of another import I would have to change it again.
Have you tried clipping the slash from the end of baseURL? I should hope the web view is smart enough to add a slash where needed, despite blindly concatenating two strings that result in a double slash.