从资源中挑选图像并加载到网络视图
问题描述:
我在资源文件夹ABC中有一个图像说明point.png。从资源中挑选图像并加载到网络视图
我要显示HTML中的图像
NSString *myFilePath= [[NSBundle mainBundle] pathForResource:@"Point1" ofType:@"png"];
NSMutableString *strForWebView = [NSString stringWithFormat:@"<html>"
"<head><b>%@</b></head><br>"
"<img src= %@ height='30' width='30' />"
, [[play quotations] objectForKey:@"Heading"], myFilePath, .......
所以现在我应该怎么做,这样它选择从它在Web视图加载图像的HTML中的路径......
请帮助
感谢
答
你们的做法是极其重要的给予正确的baseUrl加载web视图。
如果你需要的基础url不是本地加载一些外部数据,考虑通过base64演示文稿显示图像,我给出了详细信息如何在this答案中做到这一点。
在这个线程的OP中,如果只想显示本地内容,您还将看到如何使用基本url。
转到此链接。我希望这将有助于你 的http:// [stackoverflow.com/questions/6420925/load-resources-from-relative-path-using-local-html-in-uiwebview] [1] [1]:http://stackoverflow.com/questions/6420925/load-resources-from-relative-path-using-local-html-in-uiwebview – Mary 2012-07-12 12:08:30