1

我想绘制一个尺寸大于视图框架的图像,并保持原始图像的大小和质量。

我尝试用视图框架绘制,但它会失去质量。

   UIGraphicsBeginImageContext(self.imageViewDrawing.frame.size);
   [self.imageViewDrawing.image drawInRect:CGRectMake(0, 0, self.imageViewDrawing.frame.size.width, self.imageViewDrawing.frame.size.height)];

SS:http ://www.imagebam.com/image/215dd5285081681

我尝试使用图像的大小进行绘制,但它只是在图像绘制上下文帧大小中绘制。

   UIGraphicsBeginImageContext(self.imageViewDrawing.image.size);
   [self.imageViewDrawing.image drawInRect:CGRectMake(0, 0, self.imageViewDrawing.image.size.width, self.imageViewDrawing.image.size.height)];

SS:http ://www.imagebam.com/image/682962285081678

   UIGraphicsBeginImageContext(self.imageViewDrawing.frame.size);
   [self.imageViewDrawing.image drawInRect:CGRectMake(0, 0, self.imageViewDrawing.image.size.width, self.imageViewDrawing.image.size.height)];

SS:http ://www.imagebam.com/image/f80341285082782

4

1 回答 1

0

一个好的解决方案可能是使用UIIMage+Resize此处提供的类别:http: //vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/

它运作良好并保持图像质量

于 2013-10-31T07:22:22.410 回答