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]]];
UIWebView之加载本地网页
最新推荐文章于 2021-07-02 16:17:21 发布