Created
October 8, 2012 15:13
-
-
Save ebaker355/3853053 to your computer and use it in GitHub Desktop.
PaintCodeDrawableImages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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