Created
July 13, 2013 03:12
-
-
Save akinLiu/5989250 to your computer and use it in GitHub Desktop.
UIView to UIImage
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
- (UIImage*)toImage | |
{ | |
UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, 0.0); | |
[self.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return img; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment