How to get color components of a CGColor correctly

后端 未结 6 1156
日久生厌
日久生厌 2021-01-02 14:04

I have a UILabel with black color;

i am writing the following code to get black color\'s components.

UIColor *aColor = [aLabel.textColor retain];
con         


        
6条回答
  •  走了就别回头了
    2021-01-02 14:18

    One way to get RGB for these is by drawing the color into a graphics context and reading the color back out. See my answer to this question for example code:

    Get RGB value from UIColor presets

提交回复
热议问题