0
回答
UIWebView之加载本地网页
百度AI开发者大赛带你边学边开发,赢100万奖金,加群:418589053   
NSString *imagePath = [[NSBundle mainBundle] resourcePath];
imagePath = [imagePath stringByReplacingOccurrencesOfString:@"/" withString:@"//"];
imagePath = [imagePath stringByReplacingOccurrencesOfString:@" " withString:@"%20"];

NSString *HTMLData = @"
<h1>Hello this is a test</h1>
<img src="sample.jpg" alt="" width="100" height="100" />";
[webView loadHTMLString:HTMLData baseURL:[NSURL URLWithString: [NSString stringWithFormat:@"file:/%@//",imagePath]]];


原文链接:http://blog.csdn.net/favormm/article/details/6613840
<无标签>
举报
长平狐
发帖于6年前 0回/259阅
顶部