使用50x50配置文件和UIImageView进行像素化

时间:2012-02-16 23:58:09

标签: iphone image uiimageview

目前,当我在UIImageView中插入50x50图像并在屏幕上绘制图像时,图像看起来很像像素,不平滑,并且不美观。如何更改UIImageView使用的插值算法,以确保高质量?我也在使用SDWebImage从web加载图像,但这应该是无关紧要的。

UIImageView* imageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, 50, 50)];
[imageView setImageWithURL:[NSURL URLWithString:url]
          placeholderImage:[UIImage imageNamed:@"unknown.gif"]];
[cell.contentView addSubview:imageView];
[imageView release];

2 个答案:

答案 0 :(得分:0)

您正在使用50x50点的矩形创建imageView。

点和像素之间存在差异。 因此,您可能会在imageView中以50x50点放置50x50像素的图像。

因此,对于视网膜显示,您的图像应该是看起来平滑的两倍大,在这种情况下是100x100像素。

答案 1 :(得分:0)

我使用kCGInterpolationHigh将图像调整为200x200像素,然后将图像插入到UIImageView中。因此,pic看起来好多了。