Skip to content

Instantly share code, notes, and snippets.

@akbsteam
Created November 1, 2012 16:01
Show Gist options
  • Save akbsteam/3994567 to your computer and use it in GitHub Desktop.
Save akbsteam/3994567 to your computer and use it in GitHub Desktop.
+ (UIImage *)backgroundImageWithFrame:(CGRect)frame baseColor:(UIColor *)baseColor {
UIImage *colorImage;
CGRect bounds = frame;
UIGraphicsBeginImageContextWithOptions(frame.size, NO, 0.0f);
CGContextRef context = UIGraphicsGetCurrentContext();
// Fill this path
[baseColor setFill];
CGContextAddRect(context, bounds);
CGContextFillPath(context);
colorImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return colorImage;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment