简体   繁体   中英

iOS UITextView Text Highlighting

I have an UITextView and I want to highlight specific words, I like the iBooks app text highlighting, is there any way to use the same style? How can I use OpenGL to highlight text?

Thanks!

You can try to use NSAttributeString class, if I understood you right. Here's the docs https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSAttributedString_Class/Reference/Reference.html#//apple_ref/occ/cl/NSAttributedString It allows you to change font, size, color etc within a single NSString object. (for example you can type a simple regex expression to change color or set bold of a certain characters)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM