博客> wkwebview加载标签图片布局问题
wkwebview加载标签图片布局问题
2019-05-21 10:51 评论:0 阅读:182 suifumin
  • (NSString )htmlEntityDecode: (NSString )string{ string = [string stringByReplacingOccurrencesOfString:@""" withString:@"\""]; string = [string stringByReplacingOccurrencesOfString:@"'" withString:@"'"]; string = [string stringByReplacingOccurrencesOfString:@"<" withString:@"<"]; string = [string stringByReplacingOccurrencesOfString:@">" withString:@">"]; string = [string stringByReplacingOccurrencesOfString:@"&amp" withString:@"&"]; NSString *htmls = [NSString stringWithFormat:@"<html> \n" "<head> \n" "<style type=\"text/css\"> \n" "</style> \n" "</head> \n" " <meta name= \"viewport\" content =\"width=device-width, initial-scale=1.0, user-scalable=no\">" "</head>\n" "<body>" "[removed]" "[removed] = 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"
                    "}"
                    "[removed]%@"
                    "&lt;/body&gt;"
                    "&lt;/html&gt;",string];

    return htmls; }

收藏
0
sina weixin mail 回到顶部