iOS - UIColor分别获取rgb 值

2022-01-20  本文已影响0人  HanZhiZzzzz
 CGFloat * colors = CGColorGetComponents ( hsbaColor . CGColor )
如:
UIColor *color = [UIColor colorWithRed:0.0 green:0.0 blue:1.0alpha:1.0];
const CGFloat *components =CGColorGetComponents(color.CGColor);
NSLog(@"Red: %f", components[0]);
NSLog(@"Green: %f", components[1]); 
NSLog(@"Blue: %f", components[2]);

摘自:https://blog.csdn.net/xiaojian2314/article/details/20538701

上一篇下一篇

猜你喜欢

热点阅读