iOS 切屏方法
点击要切屏时点用此方法获取图片 image 极为切屏图片
- (UIImage *)captureImageFromView:(UIView *)view {
CGRect screenRect = [view bounds];
UIGraphicsBeginImageContext(screenRect.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[view.layer renderInContext:ctx];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}