标签:
NSString *path = [[NSBundle mainBundle] pathForResource:@"ad_type = 4" ofType:@"html"]; NSString *htmlStr = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; if (htmlStr != nil && [htmlStr rangeOfString:@"\\"].location != NSNotFound) { htmlStr = [htmlStr stringByReplacingOccurrencesOfString:@"\\" withString:@""]; } UIWebView *web = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 320, 50)]; [web loadHTMLString:htmlStr baseURL:nil]; [self.view addSubview:web];
解决 Json 中 Html 内容因为反编译带有"\"导致 WebView 无法直接加载问题(字符串的查找与替换)
标签:
原文地址:http://www.cnblogs.com/wzyking/p/5242980.html