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 字体
基础教程推荐
- Xcode UIView.init(frame:) 只能在主线程中使用 2022-01-01
- iOS - UINavigationController 添加多个正确的项目? 2022-01-01
- 如何比较两个 NSDate:哪个是最近的? 2022-01-01
- 如何将图像从一项活动发送到另一项活动? 2022-01-01
- Android Volley - 如何动画图像加载? 2022-01-01
- UIImage 在开始时不适合 UIScrollView 2022-01-01
- navigationItem.backBarButtonItem 不工作?为什么上一个菜单仍然显示为按钮? 2022-01-01
- SwiftUI-ScrollViewReader的ScrollTo不滚动 2022-01-01
- 为什么姜饼模拟器方向卡在应用程序中? 2022-01-01
- Play 商店的设备兼容性问题 2022-01-01
