-(UIColor *)getColor:(NSString *)hexColorString{
unsigned red,green,blue;
NSRange range;
range.length = 2;
range.location = 1;
[[NSScanner scannerWithString:[hexColorString substringWithRange:range]]scanHexInt:&red];
range.location = 3;
[[NSScanner scannerWithString:[hexColorString substringWithRange:range]]scanHexInt:&green];
range.location = 5;
[[NSScanner scannerWithString:[hexColorString substringWithRange:range]]scanHexInt:&blue];
UIColor * color = [UIColor colorWithRed:red/255.0f green:green/255.0f blue:blue/255.0f alpha:1];
return color;
}
16进制颜色转换
最新推荐文章于 2023-12-13 15:14:31 发布