iOS view截屏

xiaoxiao2021-02-28  90

截取某个view

- (UIImage )viewSnapshot:(UIView )view 

UIGraphicsBeginImageContext(view.bounds.size);  [view.layer renderInContext:UIGraphicsGetCurrentContext()];  UIImage *image = UIGraphicsGetImageFromCurrentImageContext();  UIGraphicsEndImageContext();  image = [UIImage imageWithCGImage:CGImageCreateWithImageInRect(image.CGImage,view.bounds)];  return image;  }
转载请注明原文地址: https://www.6miu.com/read-35704.html

最新回复(0)