How to highlight CoreText with changing highlight colors?

末鹿安然 提交于 2019-12-03 03:42:26

Your basic idea isn't too bad for highlighting. I don't know if it's really easier than just highlighting the glyphs while you draw, but it's not a bad idea, and makes it easy to turn on and off highlighting, so that's pretty nice.

Rather than creating lots of views, put your Core Text onto a CALayer instead. Then you can create additional highlighting layers to put over the text. This keeps everything inside of a single view. Layers are much cheaper than views. If you're just trying to do "highlighter" style highlighting, then you can just set the backgroundColor and frame for the layers and you're done.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!