Created
August 31, 2015 01:09
-
-
Save congbo/bdb31d1bbf8469805681 to your computer and use it in GitHub Desktop.
UIView 转 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 *) imageWithUIView:(UIView *)view { | |
UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, [UIScreen mainScreen].scale); | |
[view.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
UIImage * image = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return image; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment