UILabel Text with Multiple Font Colors

前端 未结 8 613
一向
一向 2020-12-19 18:48

Is there a way to have the textColor property of a UILabel be two different UIColors? Basically I\'m trying to make the first characte

相关标签:
8条回答
  • NSAttributedStrings support mixed fonts, styles, and colors in the same string, but aren't currently supported by any standard UIKit controls. That said, you should check out TTTAttributedLabel. It's a simple, performant replacement for UILabel that will allow you to display rich text really easily.

    0 讨论(0)
  • 2020-12-19 19:41

    Another alternative way is to create multiple labels with difference color and layout them next to each other. Try to make the label's background color transparent. It may be tedious but should work.

    0 讨论(0)
提交回复
热议问题