iOS 获取WKWebView屏幕显示内容的截图

    xiaoxiao2022-07-03  172

     

    - (UIImage *)createImageWithView:(UIView *)view { CGSize s = view.bounds.size; UIGraphicsBeginImageContextWithOptions(s, YES,[UIScreen mainScreen].scale); [view.layer renderInContext:UIGraphicsGetCurrentContext()]; [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES]; UIImage*image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; }

     

    最新回复(0)