+ (UIImage*)snapshot:(UIView *)shotView {
UIGraphicsBeginImageContext(shotView.frame.size);
UIGraphicsBeginImageContextWithOptions(shotView.frame.size, NO, [[UIScreen mainScreen] scale]);
CGContextRef context = UIGraphicsGetCurrentContext();
[shotView.layer renderInContext:context];
UIImage *screenShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return screenShot;
}
网友评论