0%

EFUtils示例(5)-用类似"#FF0000"初始化UIColor

用类似”#FF0000”初始化 UIColor With Hex String

1
2
3
4
5
6
7
LOG_FORMAT(@"1: %@", COLOR_HEXSTRING(@"#FFFFFF"));
UIColor *colorWithAlpha = COLOR_HEXSTRING(@"#80FFFFFF");
LOG_FORMAT(@"2: %@", colorWithAlpha);
colorWithAlpha = COLOR_HEXSTRING_ALPHA(@"#FFFFFF", 0.5);
LOG_FORMAT(@"3: %@", colorWithAlpha);
LOG_FORMAT(@"4: %@", HEXSTRING_COLOR([UIColor whiteColor]));
LOG_FORMAT(@"5: %@", HEXSTRING_COLOR(colorWithAlpha));

输出结果

1: UIExtendedSRGBColorSpace 1 1 1 1
2: UIExtendedSRGBColorSpace 1 1 1 0.501961
3: UIExtendedSRGBColorSpace 1 1 1 0.5
4: #FFFFFF
5: #80FFFFFF

相关

更新内容

相关链接调整。