欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

ios webview 文章缩放

程序员文章站 2022-06-22 23:20:38
NSString *htmls = [NSString stringWithFormat:@" \n" " \n" " \n"......

NSString *htmls = [NSString stringWithFormat:@"<html> \n"
                       "<head> \n"


                       "<meta name=\"viewport\" content=\"width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no\" /> \n"

 


                       "<style type=\"text/css\"> \n"
                       "body {font-size:15px;}\n"
                       "p {text-indent: 2em;line-height:50px}\n"
                       "</style> \n"
                       "</head> \n"
                       "<body>"
                       "<script type='text/javascript'>"
                       "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"
                       "}"
                       "</script>%@"
                       "</body>"
                       "</html>",string];

本文地址:https://blog.csdn.net/a787188834/article/details/109645225

相关标签: app苹果iOS类