is it possible to set multiple color in UILabel?

前端 未结 4 1806
一整个雨季
一整个雨季 2020-12-17 02:58

Quote from Jason Coco it not possible to set multiple in UILabel... but

how to do like this?

any idea?

相关标签:
4条回答
  • 2020-12-17 03:27

    This is not possible in iOS 5 but iOS 6 supports it. As you can see in the documentation: https://developer.apple.com/documentation/uikit/uilabel#//apple_ref/doc/uid/TP40006797

    UILabel gain the attributedText property with iOS6, next to UILabel a lot of other UI elements use NSAttributedText too.

    0 讨论(0)
  • 2020-12-17 03:31

    Nope, sadly this is not possible with UILabel. You can google some alternatives and the iPad will have NSAttributedString, but with UILabel the entire string has to be one font/color.

    0 讨论(0)
  • 2020-12-17 03:33

    FontLabel is a drop-in replacement for UILabel that can take an attributed string as its text. That will allow you use multiple colors and fonts in a single label.

    0 讨论(0)
  • 2020-12-17 03:41

    TTTAttributedLabel is a drop-in replacement for UILabel that's a lot more lightweight and simple than other libraries like FontLabel, for instance. All you would need to do is set an NSAttributedString as the text for that label.

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