2010-11-18 58 views
0

嘿,我的iPhone应用程序内有一个webView。 webView在服务器上打开一个html页面(不在iPhone上)。 现在该网站包含一个html图像。由于iPhone不缓存,并加载速度慢,我喜欢将HTML图像链接到我的应用程序中的本地资源。iPhone - 在本地资源的HTML页面中的链接图片图片

有谁知道如何做到这一点?这甚至可能吗?

+0

这个帖子看看,以帮助你通过一些陷阱http://stackoverflow.com/questions/478665/link-to-resources - 内部-WebView的iphone – 2010-11-18 18:27:06

回答

0
NSString *localPng = [[NSBundle mainBundle] pathForResource:@"item" 
                 ofType:@"png"]; 
NSData *htmlData = [NSData dataWithContentsOfFile:localPng]; 
[webView loadData:htmlData MIMEType:@"text/html" textEncodingName:@"UTF-8" 
              baseURL:[NSURL URLWithString:@""]];