NSString *color = model.display_color;
long colorLong =
strtoul([color cStringUsingEncoding:NSUTF8StringEncoding],
0, 16);
// 通过位与方法获取三色值
int R = (colorLong &
0xFF0000 )>>16;
int G = (colorLong &
0x00FF00 )>>8;
int B = colorLong &
0x0000FF;
UIColor *wordColor = [UIColor
colorWithRed:R/255.0
green:G/255.0 blue:B/255.0
alpha:1.0];
时间: 2024-11-05 18:38:11