2012-07-04 56 views
-2

我有一個UIWebView,我只是顯示一些文本。我正在使用html文本格式化UIWebView。我如何在其中包含image/UIImage?我需要顯示一個固定幀的圖像。在UIWebView中添加圖像

+0

http://stackoverflow.com/questions/5329648/display-local-uiimage-on-uiwebview –

+0

至少一個標題添加到您的問題... –

回答

4

使用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]]];