1 - (UIColor *)getColor:(NSString *)hexColor 2 { 3 unsigned int red,green,blue; 4 NSRange range; 5 range.length = 2; 6 7 range.location = 0; 8 [[NSScanner scannerWithString:[hexColor substringWithRange:range]] scanHexInt:&red]; 9 10 range.location = 2; 11 [[NSScanner scannerWithString:[hexColor substringWithRange:range]] scanHexInt:&green]; 12 13 range.location = 4; 14 [[NSScanner scannerWithString:[hexColor substringWithRange:range]] scanHexInt:&blue]; 15 16 return [UIColor colorWithRed:(float)(red/255.0f) green:(float)(green / 255.0f) blue:(float)(blue / 255.0f) alpha:1.0f]; 17 }