当前位置: 移动技术网 > 移动技术>移动开发>IOS > iOS 更改webView文字颜色丶文字大小丶背景色的方法

iOS 更改webView文字颜色丶文字大小丶背景色的方法

2018年09月17日  | 移动技术网移动技术  | 我要评论

在webview的delegate回调方法 - (void)webviewdidfinishload:(uiwebview *)webview;中写上一下语句即可

//字体大小

[webview stringbyevaluatingjavascriptfromstring:@"document.getelementsbytagname('body')[0].style.webkittextsizeadjust= '330%'"];

//字体颜色

[webview stringbyevaluatingjavascriptfromstring:@"document.getelementsbytagname('body')[0].style.webkittextfillcolor= 'gray'"];

//页面背景色

[webview stringbyevaluatingjavascriptfromstring:@"document.getelementsbytagname('body')[0].style.background='#2e2e2e'"];

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网