UIWebView 更改加载内容里面的字体大小
2012-08-08 11:40
190 查看
方法一:
方法二:
改变字体颜色
以上内容来源于互联网。
1 - (void)webViewDidFinishLoad:(UIWebView *)webView 2 { 3 // finished loading, hide the activity indicator in the status bar 4 [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; 5 [self.guideWebView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= ’150%’"]; 6 }
方法二:
1 | [ NSString stringWithFormat:@ "<html> \n" |
2 | "<head> \n" |
3 | "<style type=\"text/css\"> \n" |
4 | "body {font-family: \"%@\"; font-size: %f; color: %@;}\n" |
5 | "</style> \n" |
6 | "</head> \n" |
7 | "<body>%@</body> \n" |
8 | "</html>" , @ "宋体" , fontSize,fontColor,stringValue] ; |
1 | NSString *jsString = [[ NSString alloc] initWithFormat:@ "document.body.style.fontSize=%f;document.body.style.color=%@" ,fontSize,fontColor]; |
2 | [webView stringByEvaluatingJavaScriptFromString:jsString]; |
3 | [jsString release]; |
相关文章推荐
- UIWebView 更改加载内容里面的字体大小
- UIWebView 更改加载内容里面的字体大小
- uiwebview加载网页后根据内容设置大小
- uiwebview 加载html时字体变小 加载前或加载后改变字体大小
- UIWebView中加载HTML的Table,td设置百分比宽度并且宽度不被里面的内容撑开
- android根据内容动态更改TextView的字体大小
- MFC中在重载函数中更改字体大小
- \t\t在textarea里面插入图片,修改字体大小和颜色(文本富编辑)接上一篇
- 【转】android webview设置内容的字体大小
- eclipse配置字体大小和使用Color Theme插件更改主题
- TextView部分内容改变颜色,背景色,大小,字体,超链接,删除线,下划线,添加图片
- 修改XtraMessageBox的内容字体大小
- 字体太小Win10下更改系统字体大小的方法
- Win10下更改系统字体大小让字体看起来更舒服
- 如何正常设置VS 2005 字体大小与颜色(附助解决包加载失败的问题)
- Eclipse中如何更改Java编辑界面和Jsp编辑界面的字体大小?
- 【rzxt】简单几步教你快速更改Win8的字体大小
- 嵌入式表单字段中的内容可能被服务器更改以删除不安全的内容。是否要重新加载您的页面以查看保存结果?
- Sublime text 3更改侧边栏【sidebar】的字体大小
- Html中超链接的字体颜色大小格式更改