Created
June 20, 2013 23:40
-
-
Save justinHowlett/5827739 to your computer and use it in GitHub Desktop.
UIView Category for producing a raster copy
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
#include <QuartzCore/QuartzCore.h> | |
@implementation UIView (Raster) | |
-(UIImage*)getRasterCopy{ | |
/* returns UIImage of any UIView */ | |
UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, 0.0); | |
[self.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return resultingImage; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment