Search code examples
iosinterface-buildernsattributedstring

UILabel NSAttributedString in IB with static and dynamic text


"Time: 6:00 AM"
I have a label with above text. the text "Time:" is static and black in color. Where as the text "6:00 AM" is dynamic and blue in color. I know how to have multiple fonts and colors for a Label when the text is static. But if I have a combination of static and dynamic texts, is it possible to manage multiple fonts and colors through IB ? Or doing it programmatically is the possible solution ?

Thanks


Solution

  • Using NSMutableAttributedString you can do this .

    Here is the link you are looking for.

    Change string color with NSAttributedString?

    How do you use NSAttributedString?