0

我不可能得到我从 XML 中解析出来的图像来显示在我UIImageView使用下面的代码中。我是不是做错了什么,因为我用它来检查它NSLog是否有链接,显然有。

NSString *imageURL = [currentData.imageLink];
NSLog(@"this is link = %@", imageURL);
[cachedList addObject:imageURL];
[myCache setObject:cachedList forKey:@"imageURL"];
cachedList = [myCache objectForKey:@"imageURL"];  /where cachedList is NSMutableArray

for(id obj in cachedList){
    NSLog(@"value = %@", obj); //to show value
    cell.imageShow.image = [UIImage imageNamed:obj];
 }

我也尝试执行以下代码,但它给了我一个错误。

 if (cachedList != nil) {
     cell.imageShow.image = [UIImage imageNamed:[cachedList valueForKey:@"imageURL"]];
 }
4

1 回答 1

0

我想如果你使用的是 UITableView 那么这是我用过的东西,我更喜欢 tableview

链接:https ://github.com/jakemarsh/JMImageCache

于 2013-08-20T12:04:09.880 回答