Skip to content

Instantly share code, notes, and snippets.

@ebaker355
Created October 8, 2012 15:13
Show Gist options
  • Save ebaker355/3853053 to your computer and use it in GitHub Desktop.
Save ebaker355/3853053 to your computer and use it in GitHub Desktop.
PaintCodeDrawableImages
typedef void (^PaintCodeSourceBlock)();
@implementation PaintCodeDrawableImages
+ (UIImage *)drawImageWithSize:(CGSize)size paintCodeSource:(PaintCodeSourceBlock)paintCodeSourceBlock
{
// Begin the image context.
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0f);
// Draw the paint code image.
paintCodeSourceBlock();
// Create UIImage from context.
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment