How to get RGB values from UIColor?

后端 未结 15 1676
孤城傲影
孤城傲影 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:06

    I wanted to get the background color of the UITableViewStyle "UITableViewStyleGrouped" so in the viewDidAppear: method I added the code:

    NSLog(@"%@", self.tableView.backgroundView.backgroundColor);

    It did what I anticipated and returned the log:

    UIDeviceRGBColorSpace 0.937255 0.937255 0.956863 1

    So in short just type in NSLog(@"%@", [UIColor whateverColor]);

提交回复
热议问题