Can I mix two UIColor together?

后端 未结 6 1509
暖寄归人
暖寄归人 2021-01-12 05:51

I have colorA which is [UIColor blueColor], and colorB, which is [UIColor redColor]. Is this possible for me to render a [UIColor purple]

6条回答
  •  生来不讨喜
    2021-01-12 06:42

    Ask each input color for its RGBA components using -[UIColor getRed:green:blue:alpha:]. Average the components from each, and create a new color using +[UIColor colorWithRed:green:blue:alpha:].

提交回复
热议问题