在UIWebView中添加图像

Ror*_*ter -2 iphone uiwebview uiimageview ios

我有一个UIWebView,我只是显示一些文字.我正在使用html文本格式化UIWebView.我怎么能在image/UIImage里面加一个呢?我需要显示一个固定帧的图像.

Sri*_*aju 5

使用img标签.在HTML代码中注入它并将其呈现在UIWebView.

这应该有帮助 -

NSString *html = @"<html><body style='margin:0;'><img width='300' height='300' src='my_test_image.jpg'></body></html>";
[web loadHTMLString:html baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]];
Run Code Online (Sandbox Code Playgroud)