How to I properly set UIColor from int?

后端 未结 6 859
余生分开走
余生分开走 2021-01-05 11:47

I am trying to set the textColor of a UITextView by assigning it a value.

Earlier in the program I have

textView.textColor         


        
6条回答
  •  悲&欢浪女
    2021-01-05 11:56

    You can do this by following these steps:

    1. Do convert hex value to RGB use HexToRGB.

    2. And then change the text color of your textview by doing this :

       textview.textColor = [UIColor colorWithRed:244/255.00f
          green:133/255.00f blue:116/255.00f alpha:1.0f]; // values are just an example
      

提交回复
热议问题