iso 获得UIColor中RGB各个元素的值
UIColor *clr = [UIColor colorWithRed:0.3f green:0.4f blue:0.7f alpha:0.8f];
CGColorRef clrRef = [clr CGColor];
const CGFloat *components = CGColorGetComponents(clrRef);
NSUInteger componentsCount = CGColorGetNumberOfComponents(clrRef);
NSUInteger counter = 0;
for (counter = 0; counter < componentsCount; counter++) {
NSLog(@"Component %lu = %.02f", (unsigned long)counter + 1, components[counter]);
}
/***************************************************/