一般UIView转换成图片的方法
UIGraphicsBeginImageContext(rect.size);
[view.paintView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
修改图片生成方法,使图片更加清晰
UIGraphicsBeginImageContextWithOptions(,,);
第一个参数,图片大小
第二个参数,透明效果,半透明传NO
第三个参数,屏幕密度,[UIScreen mainScreen].scale
UIGraphicsBeginImageContextWithOptions(rect.size, YES, 0.0);
[view.paintView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *imageData = UIImageJPEGRepresentation(image,1.0f);