ios 截取view上内容 返回image 保证清晰度

来源:互联网 发布:最好的数据统计软件 编辑:程序博客网 时间:2024/05/16 17:11

直接调用下面方法,传入要截取图片的view,返回image,能保证清晰度

//获取截图-(UIImage *)getImageFromView:(UIView *)orgView{    CGSize s = orgView.bounds.size;    UIGraphicsBeginImageContextWithOptions(s, NO, [UIScreen mainScreen].scale);        [orgView.layer renderInContext:UIGraphicsGetCurrentContext()];        UIImage*image = UIGraphicsGetImageFromCurrentImageContext();        UIGraphicsEndImageContext();        return image;}



0 0
原创粉丝点击