5

The issues is cause by setting a custom color in the storyboard,its not related to custom font.

Step 1: Define color in Assets Folder

enter image description here

Step 2: Set that color as label text color

enter image description here

Step 3: Change the text color in code

enter image description here

Label background color is changing but text color is not changing

Imran
  • 3,045
  • 2
  • 22
  • 33
  • Possible duplicate of [Font color for UILabel not changing](https://stackoverflow.com/questions/25355709/font-color-for-uilabel-not-changing) – Tamás Sengel Sep 16 '18 at 14:55
  • What result do you get? And What color are you expecting to get as a result of your code? You're setting the label to have different colors (the one set in storyboard vs the one set on code) – Mauricio Chirino Sep 17 '18 at 01:53
  • I had the same issue. This answer worked for me: https://stackoverflow.com/a/51559466/9769851 – egabor Aug 07 '19 at 09:39

1 Answers1

8

I faced the exact same problem. I suppose it's a bug in the xCode. The issue arrises when you set custom colour in storyboard or xib. What you can do:

  1. Use some standard colour in your nib file/storyboard
  2. If you want to change it with some colour asset this can be done programmatically at any time

I tried it and it works.

Sophie
  • 81
  • 1
  • 2