在webView的delegate回调方法-webViewDidFinishLoad:(UIWebView*)webView;中写上以下语句即可
//字体大小
[webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName(‘body‘)[0].style.webkitTextSizeAdjust= ‘110%‘"];
//字体颜色
[webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName(‘body‘)[0].style.webkitTextFillColor= ‘gray‘"];
//页面背景色
[webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName(‘body‘)[0].style.background=‘#2E2E2E‘"];
时间: 2024-10-10 11:09:31