ios html 字体加粗,iOS webview 加载html字符串,设置字体和图片自适应
NSString *content = [content stringByReplacingOccurrencesOfString:@""" withString:@"'"];content = [content stringByReplacingOccurrencesOfString:@"<" withString:@"content = [content stringBy
NSString *content = [content stringByReplacingOccurrencesOfString:@""" withString:@"'"];
content = [content stringByReplacingOccurrencesOfString:@"<" withString:@"
content = [content stringByReplacingOccurrencesOfString:@">" withString:@">"];
content = [content stringByReplacingOccurrencesOfString:@""" withString:@"\""];
NSString *htmls = [NSString stringWithFormat:@" \n"
"
\n"" \n"
"
"body {font-size:15px;}\n"
" \n"
" \n"
"
""
"window.onload = function(){\n"
"var $img = document.getElementsByTagName('img');\n"
"for(var p in $img){\n"
" $img[p].style.width = '100%%';\n"
"$img[p].style.height ='auto'\n"
"}\n"
"}"
"%@"
""
"",content];
[_webView loadHTMLString:htmls baseURL:nil];
更多推荐
所有评论(0)