UIWebView: Access to OS graphics/resources?

118 views Asked by At

I am using a UIWebView instance to show a help page in an app. Within that HTML can I make reference to graphics provided by the OS (e.g., backgrounds, icons, etc.)? What would be the URLs to said resources?

1

There are 1 answers

0
Allen Pestaluky On

Check out this page: http://iphoneincubator.com/blog/windows-views/uiwebview-revisited

Here's a summary of what Nick wrote:

First, include the graphics resources in your project. Then when loading your HTML into the UIWebView, use the main bundle path as your baseURL:

NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
[webView loadHTMLString:htmlString baseURL:baseURL];

These resources can now be accessed:

<img src="myimage.png">