Skip to content

Instantly share code, notes, and snippets.

@madninja
Created October 3, 2011 15:41
Show Gist options
  • Save madninja/1259398 to your computer and use it in GitHub Desktop.
Save madninja/1259398 to your computer and use it in GitHub Desktop.
CGGradientUtils
CGGradientRef CGGradientCreateWithUIColors(CGColorSpaceRef space, NSArray *colors, const CGFloat locations[])
{
NSMutableArray *cgColors = [NSMutableArray arrayWithCapacity:colors.count];
[colors enumerateObjectsUsingBlock:^(UIColor *color, NSUInteger idx, BOOL *stop) {
[cgColors addObject:(id)color.CGColor];
}];
return CGGradientCreateWithColors(space, (CFArrayRef)cgColors, locations);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment