Font color for UILabel not changing

后端 未结 5 1532
别跟我提以往
别跟我提以往 2020-12-17 09:51

I am trying to display numbers on a UILabel with a bold black font and size 50.

After some failed attempts I just realized that no matter what color I set the font t

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-17 10:00

    I got this to work for a table or collection view cell by setting the color first to a system color, then to my custom color in cellForRowAtIndexPath e.g.

    myLabel.textColor = .black
    myLabel.textColor = UIColor(named: "My custom color")
    

提交回复
热议问题