0

当用户像这样登录时,我缓存了一个图像:
这是在一个Utility.m

UIImage *image = [UIImage imageWithData:newProfilePictureData];

UIImage *mediumImage = [image thumbnailImage:280 transparentBorder:0 cornerRadius:0 interpolationQuality:kCGInterpolationHigh];
UIImage *smallRoundedImage = [image thumbnailImage:64 transparentBorder:0 cornerRadius:9 interpolationQuality:kCGInterpolationLow];

NSData *mediumImageData = UIImageJPEGRepresentation(mediumImage, 0.5); // using JPEG for larger pictures
NSData *smallRoundedImageData = UIImagePNGRepresentation(smallRoundedImage);

稍后我想将小图像加载到UIImageView
这是在UITableView-cellForRowAtIndexPath

[cell.leftIcon setImage:

有谁知道我如何引用缓存的图像?

4

1 回答 1

0

您需要在 Utility.m 中使用以下方法,

+(NSString*)getImage {
    return smallRoundedImage;
}

然后像下面这样使用它,

[cell.leftIcon setImage:[Utility getImage]];

PS:这只是一个例子,您可以根据您的要求做得更好!

于 2012-10-28T23:31:27.000 回答