问题描述
我要求在UITextView中使用多种字体样式。单个Textview中的粗体,斜体和下划线文本。喜欢:
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.
谢谢
推荐答案
你是对的,标准的UITextView不支持丰富的编辑。目前有一些问题的解决方案。
You're right that the standard UITextView does not support rich editing. At the moment there are a few solutions to the problem.
Omni Group有。其中包括一个非常强大的富文本编辑器(参见:OUIEditorFrame.m)。这些非常强大但也非常复杂。他们的样本iPad应用程序包含富文本编辑器示例。进一步的讨论可以在找到
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.
最后,你可以自己完成所有这一切并创建一个实现UITextInput协议的编辑器控件。除了Apple文档之外,还有一些关于的提示。
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中使用多种字体样式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!