ios UIColor转化为RGB值
2017-07-17 14:40
274 查看
该方法把转入来的UIColor对像转化为RGB对应颜色值输出,大小在0-1之间
-(RGBValue)readRGBForUIColor:(UIColor*)color{ const CGFloat *components = CGColorGetComponents(color.CGColor); Byte b = components[2] * 255; Byte g = components[1] * 255; Byte r = components[0] * 255; RGBValue rgb; rgb.blue = b; rgb.green = g; rgb.red = r; NSLog(@"red:%x\ngreen:%x\nblue:%x",r,g,b); return rgb; }
相关文章推荐
- IOS中UIImage和UIColor相互转化
- iOS 里RGB 配色 UIColor colorWithRed
- iOS 获取UIColor对象的rgb值。
- iOS小项目---UIColor采用rgb
- ios客户端学习-颜色将16位值转换成rgb值,UIColor与字符串互转
- iOS开发中十六进制颜色与RGB的相互转化
- [iOS]根据UIColor获取及改变RGB和Alpha
- iOS中(以#开头)十六进制的颜色转换为UIColor(RGB)
- iOS UIColor RGB HEX
- iOS 十六进制转化为RGB值
- iOS开发笔记(四):网页颜色值转化成UIColor
- IOS---UIColor RGB颜色对照表
- iOS 之如何将#000000颜色转化成RGB
- XZ_iOS之UIColor的RGB数值转换方法
- IOS中如何将十六进制颜色的字符串转化为UIColor
- iOS16进制RGB值转换成UIColor
- iOS 里RGB 配色 UIColor colorWithRed
- IOS 由RGB、UIColor生成UIImage
- IOS中UIImage与UIColor相互转化
- UI for iOS(一)-- RGB十六进制字符串转换UIColor