我正在实现一个UIWebView。在那我只需要显示两个images.One来自服务器路径,一个是本地。如果我将baseURL指向服务器,服务器图像正在加载,如果我将其更改为Bundle url它只加载本地图像。我不知道到底出了什么问题。请查看我的代码,如果我有任何错误,请告诉我。
NSString *absStirng=[[[NSBundle mainBundle] resourceURL] absoluteString];
appendString =[appendString stringByAppendingString:@"<html>"];
appendString =[appendString stringByAppendingString:@"<body>"];
appendString =[appendString stringByAppendingString:@"<a href='/#/'><img src="];
appendString =[appendString stringByAppendingString:absStirng];
appendString =[appendString stringByAppendingString:@"image.png /></a>"];
appendString =[appendString stringByAppendingString:@"<a href='/#/'><img src="];
appendString =[appendString stringByAppendingString:@"image.png /></a>"];
appendString =[appendString stringByAppendingString:@"</body>"];
appendString =[appendString stringByAppendingString:@"</html>"];
[myWebView loadHTMLString:returnString baseURL:[NSURL URLWithString:@"http://serverUrl/"];
答案 0 :(得分:0)
传递远程图像的完整URL路径。