Created
December 10, 2013 15:49
-
-
Save adow/7892831 to your computer and use it in GitHub Desktop.
Make an image for UIView
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
///为UIView创建一个截图 | |
static inline UIImage* WKFlip_make_image_for_view(UIView* view){ | |
double startTime=CFAbsoluteTimeGetCurrent(); | |
if(UIGraphicsBeginImageContextWithOptions != NULL){ | |
UIGraphicsBeginImageContextWithOptions(view.frame.size, NO, 0.0); | |
} else { | |
UIGraphicsBeginImageContext(view.frame.size); | |
} | |
[view.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
UIImage* image=UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
NSLog(@"makeImage duration:%f", CFAbsoluteTimeGetCurrent()-startTime); | |
return image; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment