下面的代码是获取UIView,作为UIImage保存到Docs Dir。
- (UIImage *) imageWithView:(UIView *)view
{
UIGraphicsBeginImageContext(view.bounds.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
UIImage保存成功,但是分辨率非常差。如下图,怎么提高图片的质量?和原来的图片一样最好。