简体   繁体   中英

display image in html in webview from document directory

I would like to display an image in html which is being displayed on a UIWebView from the App's Document directory.

Can someone suggest me how to accomplish that?

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

You can then refer to your images like this:

   <img src="myimage.png">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM