我可以在 UITextView 中使用多种字体样式吗?

编程入门 行业动态 更新时间:2024-10-26 09:24:47
本文介绍了我可以在 UITextView 中使用多种字体样式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要在 UITextView 中使用多种字体样式.像单个 Textview 中的粗体、斜体和下划线文本.喜欢:

一个单词是粗体第二个可能是斜体第三个下划线根据用户选择.

我认为这是不允许的,但如果有人已经取得并想要分享的话.我在输入文本时都需要这个,在显示时也需要这个.

谢谢

解决方案

你说得对,标准的 UITextView 不支持富编辑.目前有一些解决方案.

Omni Group 在开源许可下发布了他们的 iOS 和 Mac 框架.其中包括一个非常强大的富文本编辑器(参见:OUIEditorFrame.m).这些功能非常强大,但也非常复杂.他们的示例 iPad 应用程序包括富文本编辑器示例.进一步的讨论可以在这里找到p>

其次,这家伙一直在工作在自定义富文本编辑控件上,并根据可协商的许可协议提供它.

最后,您可以自己完成这一切,并创建一个实现 UITextInput 协议的编辑器控件.除了 Apple 文档之外,还有一些关于执行此操作的提示这里.

I have a requirement to use multiple font style in UITextView. Like Bold, Italic and Underline text in single Textview. Like:

One word is Bold second may be italic third Underline as per user selection.

I don't think this is allowed to do but still if any one have achieved and want to share. I need this all while enter text and same while displaying.

Thanks

解决方案

You're right that the standard UITextView does not support rich editing. At the moment there are a few solutions to the problem.

The Omni Group has released their iOS and Mac frameworks under an open source license. These include a very powerful rich text editor (see: OUIEditorFrame.m). These are very powerful but also extremely complex. Their sample iPad app includes the rich text editor example. Further discussion can be found here

Secondly, this guy has been working on a custom rich text editing control and is offering it under a negotiable licensing agreement.

Finally, you can do it all yourself and create an editor control that implements the UITextInput protocol. Aside from the Apple documentation, there are some tips on doing this here.

更多推荐

我可以在 UITextView 中使用多种字体样式吗?

本文发布于:2023-11-06 14:41:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1563976.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:样式   多种   字体   UITextView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!