开发者

Can I use multiple font style in UITextView?

开发者 https://www.devze.com 2023-03-02 01:57 出处:网络
I have a requirement to use开发者_如何学JAVA multiple font style in UITextView. Like Bold, Italic and Underline text in single Textview. Like:

I have a requirement to use开发者_如何学JAVA 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.


Why don't you use attributed string and use its property to set the string as you like. Reference link : https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/AttributedStrings/Tasks/CreatingAttributedStrings.html

0

精彩评论

暂无评论...
验证码 换一张
取 消