ios 获取UIView截图

作者: 一个萝卜X个坑 | 来源:发表于2018-09-24 15:27 被阅读19次
    #pragma mark 获取截屏图片
    -(UIImage *)captureScreenForView:(UIView *)currentView {
        
        UIGraphicsBeginImageContextWithOptions(CGSizeMake(currentView.size.width, currentView.size.height), NO, 0.0);//原图
        [currentView.layer renderInContext:UIGraphicsGetCurrentContext()];
        UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        
        return  viewImage;
    }
    

    相关文章

      网友评论

        本文标题:ios 获取UIView截图

        本文链接:https://www.haomeiwen.com/subject/zqthoftx.html