How can I set a cell on the iPhone as a custom color?

前端 未结 1 600
忘了有多久
忘了有多久 2020-12-22 06:32

I am trying to add custom color like how we do in HTML:

 . 

Can we have a similar kind of custom c

相关标签:
1条回答
  • 2020-12-22 06:40

    Use UIColor colorWithRed:green:blue:alpha:. Colors are 0.0 to 1.0, something like this for bright red:

    cell.backgroundColor = [UIColor colorWithRed:1.0f green:0 blue:0 alpha1];
    

    For a color such as "808182" it would be:

    [UIColor colorWithRed:128/255.0f green:129/255.0f blue:130/255.0f alpha:1];
    
    0 讨论(0)
提交回复
热议问题