如何更改UIWebView的默认字体 [英] How to change UIWebView default font
本文介绍了如何更改UIWebView的默认字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$ p $
[webView setFont: [UIFont fontWithName:@GothamRounded-Boldsize:14]
是否有这样的属性或其他只要在< font face>
标签前添加一个前缀,就可以将 加载到webView之前你的字符串。
NSString * body = [plist objectForKey:@foo];
NSString * htmlString =
[NSString stringWithFormat:@< font face ='GothamRounded-Bold'size ='3'>%@,body];
[webView loadHTMLString:htmlString baseURL:nil];
What font does UIWebView use by default? I would like to be able to change that. But I don't want to do it in the html string, instead I want to have something like:
[webView setFont:[UIFont fontWithName:@"GothamRounded-Bold" size:14]
is there such property or some other way?
解决方案
Just prefix a <font face>
tag to your string before loading into the webView.
NSString *body = [plist objectForKey:@"foo"];
NSString *htmlString =
[NSString stringWithFormat:@"<font face='GothamRounded-Bold' size='3'>%@", body];
[webView loadHTMLString:htmlString baseURL:nil];
这篇关于如何更改UIWebView的默认字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文