Capture UIView and Save as Image

前端 未结 7 521
孤城傲影
孤城傲影 2020-12-02 19:31

First of i Add the UILable on UIImageView and then after i screenshot the UIView, the image not proper capture the UIView

相关标签:
7条回答
  • 2020-12-02 19:57

    Try this if you want captured image maintain its original quality.

    - (UIImage *)captureViewWithAllSubView:(UIView *)view {
        UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0f);
        [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
        UIImage *capturedImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        return capturedImage;
    }
    
    0 讨论(0)
提交回复
热议问题