清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
+ (UIColor *)colorFromHex:(NSString *)hexString alpha:(CGFloat)alpha { int i=0,temp=0,n; const char *s = [hexString cStringUsingEncoding:NSUTF8StringEncoding]; if (hexString.length < 6) { return nil; } int colorC[3]; for (int index = 0; index < 3; index ++ ) { for(i = 0; i < 2; i ++ ) { char a = s[i + index * 2]; if(a>='A' && a<='F') n = a - 'A' + 10; else if(a>='a' && a<='f') n = a - 'a' + 10; else n = a - '0'; temp= temp * 16 + n; } colorC[index] = temp; temp = 0; } UIColor *color = [UIColor colorWithRed:colorC[0]/255.0 green:colorC[2]/255.0 blue:colorC[2]/255.0 alpha:alpha]; return color; }