iPhone Development - Setting UIWebView font(iPhone 开发 - 设置 UIWebView 字体)
问题描述
我必须显示从服务器中提取的富文本,所以我使用的是 UIWebView.现在的问题是我无法控制 UIWebView 中使用的字体.如何更改字体以使用系统字体(使其与应用程序的其余部分保持一致)?
I have to show rich text that i pull from server, so i'm using UIWebView. Now the problem is that i have no control over the font which is used in UIWebView. How can i change the font to use system font (making it consistent with rest of the application)?
我现在正在做这样的事情:
I'm doing something like this at the moment:
myRichTextView = [[UIWebView alloc] initWithFrame:CGRectMake(x, y, width, height)];
myRichTextView.backgroundColor = [UIColor clearColor];
[myRichTextView setScalesPageToFit:NO];
[myRichTextView loadHTMLString:myString baseURL:[NSURL URLWithString:myBaseURL]];
再次,需要控制显示字体.如果我无法控制字体,请告诉我 UIWebView 的其他替代方案.
Again, need to control the display font. If i can't control the font, please let me know other alternatives to UIWebView.
谢谢
推荐答案
在你的 HTML 文档中引用一个 css 样式表或者把样式信息放到 HTML 文档本身的顶部
Reference a css style sheet in your HTML document or put the style information into the top of the HTML document itself
这篇关于iPhone 开发 - 设置 UIWebView 字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iPhone 开发 - 设置 UIWebView 字体


基础教程推荐
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01