iOS 截图

//截图
- (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;
}

你可能感兴趣的:(iOS 截图)