Created
May 11, 2013 08:32
-
-
Save guruguruman/5559318 to your computer and use it in GitHub Desktop.
Capturing image from rendered view.
This file contains 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
+ (UIImage *)viewAsImage:(UIView *)aView { | |
if (!aView) { | |
return nil; | |
} | |
UIGraphicsBeginImageContext(aView.bounds.size); | |
[aView.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
UIImage *aViewAsImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return aViewAsImage; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment