Created
February 9, 2012 23:40
-
-
Save codecaffeine/1784296 to your computer and use it in GitHub Desktop.
Get a UIImage from a UIView
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
#import <QuartzCore/QuartzCore.h> | |
- (UIImage *)caf_imageRepresentation | |
{ | |
UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, 0.0); | |
[self.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return image; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment