Image Path When Using CSS to style UIWebView
I am loading a CSS file to style a UIWebView. I would like to have an inline "play" button when the CSS det开发者_开发技巧ects a video. I have it working except it is not loading the image (it is loading the image placeholder but not the image). I'm using the following CSS:
span.vvqbox:after { content:url(watchvideo.png) }
The .css file is in the same directory as the .png.
Assuming that you are loading a local html file (that loads a local css file) and you are using the - (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL
method of UIWebView you will need to set the baseURL to your bundle so the webview knows where to load the images.
[webview loadHTMLString:htmlString baseURL:[[NSBundle mainBundle] bundleURL]];
精彩评论