小弟在用webview的时候,显示的文本不会自动换行和字体显示过小,加载的图片没有按屏幕大小适配。
先来说说文本的自动换行:
html文本是直接从服务器获取的,就只有html文本,不带css格式不带js。
然后网上查找一番之后加入下面代码,并在原来的html文本基础上添加了css格式
<body width=device-width style=\"word-warp:break-word;font-family:Arial\">%@</body></html>
在body后面添加 width=device-width style=\"word-warp:break-word;font-family:Arial\" 实现自动换行
//WKWebView
WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];
WKUserContentController *userContentController = [[WKUserContentController alloc] init];
// 自适应屏幕宽度js
NSString *jSSt