美文网首页
iOS - UIColor分别获取rgb 值

iOS - UIColor分别获取rgb 值

作者: HanZhiZzzzz | 来源:发表于2022-01-20 11:42 被阅读0次
     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

    相关文章

      网友评论

          本文标题:iOS - UIColor分别获取rgb 值

          本文链接:https://www.haomeiwen.com/subject/wqrncrtx.html