Collection View中的图像质量很差

时间:2014-09-08 14:00:41

标签: ios uiimage

我有一个包含大量图像的集合视图,但问题是图像在集合视图中非常模糊和像素化。当我选择其中一张图片时,它会显示更大的图片,使其看起来质量足够好。所以我猜测它将图片缩放成一个小的单元格,这使得它在集合视图中的质量很差。如何修复图像,使其在集合视图中看起来不模糊/质量差?

实际图片尺寸为640x853,单元尺寸为100x133。 这就是我所拥有的:

 UIImage *theImage = [UIImage imageWithData:data];



                UIGraphicsBeginImageContext(CGSizeMake( cell.frame.size.width, cell.frame.size.height));
                [theImage drawInRect: CGRectMake(0, 0, cell.frame.size.width, cell.frame.size.height)];
                UIImage *small = UIGraphicsGetImageFromCurrentImageContext();
                UIGraphicsEndImageContext();

            UIImageView *cellImageView = [[UIImageView alloc] initWithImage:small];
                            cell.backgroundColor = [UIColor whiteColor];
            cell.clipsToBounds = YES;
            [cell.contentView addSubview:cellImageView];

0 个答案:

没有答案
相关问题