//截图
- (UIImage*)screenSnapshot:(UIView *)view{
UIGraphicsBeginImageContextWithOptions(view.frame.size, NO, 0);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImage *img = [[UIImage alloc] initWithData: UIImagePNGRepresentation(image)];
return img;
}
网友评论