十六进制和Photoshop值的UIColor
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了十六进制和Photoshop值的UIColor相关的知识,希望对你有一定的参考价值。
//In header #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] //usage UIColor *color = UIColorFromRGB(0x000000) //you can also use it inline [text.textField setTextColor:UIColorFromRGB(0xcccccc)]; #define PhotoshopColorValue(x) (x / 255.0) #define UIColorFromPhotoshopRGBA(r,g,b,a) [UIColor colorWithRed:PhotoshopColorValue(r) green:PhotoshopColorValue(g) blue:PhotoshopColorValue(b) alpha:a] #define UIColorFromPhotoshopHSBA(h,s,b,a) [UIColor colorWithHue:PhotoshopColorValue(h) saturation:PhotoshopColorValue(s) brightness:PhotoshopColorValue(b) alpha:a] #define UIColorFromHexValue(hex) UIColorFromPhotoshopRGBA(((hex & 0xFF0000) >> 16), ((hex & 0xFF00) >> 8), (hex & 0xFF), 1.0)
以上是关于十六进制和Photoshop值的UIColor的主要内容,如果未能解决你的问题,请参考以下文章