iphone, when saving image with “renderInContext” t

2019-06-16 16:15发布

I'm using this code to render an image from view. Then i am saving it to photo album. The image is blurry? Why? Is there a solution?

UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

Tnx all.

1条回答
Rolldiameter
2楼-- · 2019-06-16 16:34

You are propably using a retina device, Change the following

UIGraphicsBeginImageContext(self.view.bounds.size)

to

UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);
查看更多
登录 后发表回答