1

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?

4

1 回答 1

0

看看这个页面:http: //iphoneincubator.com/blog/windows-views/uiwebview-revisited

以下是尼克所写内容的摘要:

首先,在您的项目中包含图形资源。然后在将您的 HTML 加载到 UIWebView 中时,使用主包路径作为您的 baseURL:

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

现在可以访问这些资源:

<img src="myimage.png">
于 2012-03-28T19:45:44.393 回答