开发者

Image Path When Using CSS to style UIWebView

开发者 https://www.devze.com 2023-03-14 18:12 出处:网络
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 lo

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]];
0

精彩评论

暂无评论...
验证码 换一张
取 消