How to get RGB values from UIColor?

后端 未结 15 1696
孤城傲影
孤城傲影 2020-11-28 22:27

I\'m creating a color object using the following code.

curView.backgroundColor = [[UIColor alloc] initWithHue:229 saturation:40 brightness:75 alpha:1];
         


        
15条回答
  •  余生分开走
    2020-11-28 23:17

    The top voted answer is outdated:

    error: :3:1: error: 'CGColorGetComponents' has been replaced by property 'CGColor.components'

    Instead, use

    myUIColor.cgColor.components

提交回复
热议问题