我需要渲染文本,但不在 UIWebView 中

发布于 2024-12-12 08:28:37 字数 194 浏览 3 评论 0原文

我已经查了很多,但找不到好的文本渲染解决方案。就我而言, uiwebview 不能满足我的需求。此外,文本必须使用多种字体。我希望它像 iBooks 中一样,文本渲染速度非常快(不像 uiwebview 中的那样)或者可能是 uiwebview,但是他们如何做到快速加载呢?

文本还应该支持文本选择和其他用户交互。

我愿意接受建议,提前致谢!

I've looked quite a lot but can't find a good text rendering solution. In my case uiwebview doesn't fullfil my needs. Also the text has to be with multiple fonts. I would like it to be like in iBooks, the text renders very fast(not like in the uiwebview) or maybe it's uiwebview, but then how do they do it to load that fast?

The text should also support text selection and other user interactions.

I'm open for suggestions, thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

北渚 2024-12-19 08:28:37

您可以查看 NSAttributedString-Additions-for-HTML,它会创建 < code>NSAttributedString 来自 HTML,并位于 TTTAttributedLabel (或 OHAttributedLabel),支持 NSAttributedStringsUILabel 的直接替代品代码>.

You can have a look at NSAttributedString-Additions-for-HTML, it creates NSAttributedString from HTML, and at TTTAttributedLabel (or OHAttributedLabel), a drop-in replacement for UILabel that supports NSAttributedStrings.

青巷忧颜 2024-12-19 08:28:37

It sounds like you should look at Core Text. It is framework intended specifically for text rendering.

ヅ她的身影、若隐若现 2024-12-19 08:28:37

您应该看看 Core Text 框架。仅用于某些文本行可能有点复杂,但它可能正是您正在寻找的。

这是苹果官方文档:
Core Text Framework Apple 官方文档

对于初学者来说,这是一个很好的链接:
交友核心文本

You should have a look at the Core Text framework. It can be a bit complicated to use just for some lines of text, but it may be what you are looking for.

Here is the Apple official documentation :
Core Text Framework Apple official documentation

And here is a good link for beginners :
Befriending Core Text

可爱咩 2024-12-19 08:28:37

文本选择和用户与 CoreText 的交互并不是那么简单。

据我所知,支持文本选择的最好的开源库是 OmniGroup

查看他们的 TextEditor 示例,了解与您要求的类似的内容。

Text selection and user interaction with CoreText is not so simple.

The best open source library that I know of that supports text selection is OmniGroup.

Look at their TextEditor example for something similar to what you requested.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文