我在我的项目中使用了ASIHTTPRequest框架来处理所有与网络有关的任务。ASIHTTPRequest同时下载桌面视图上的图像需要时间
我有自定义单元格与来自web服务器的缩略图,有大约500个图像,所以我不得不重复使用单元格来处理它。当我们滚动浏览tableview时,由于重复使用单元格,我们可以看到之前单元格的图像,这些图像将被新图像替换。
如果网络连接低,它更糟糕,因为它需要大量的时间来下载图像..所以当时你可以看到特定的错误图像,因为重新使用单元格,所以我需要找到方法,以便这种图像替换不应该'用户不可见。
我正在使用ASIDownalod SharedCache方法。
编辑
NSString *reuseIdentifier = @"offerCell";
BRZOfferCell *offerCell = (BRZOfferCell*)[tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
if (offerCell==nil) {
offerCell = [[[BRZOfferCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier celltype:kDealCellTypeDealsList] autorelease];
}
[offerCell setImage:[UIImage imageNamed:IMAGE_NO_IMAGE]];
//---get the letter in the current section---
//NSString *alphabet = [mDealsIndex objectAtIndex:[indexPath section]];
//---get all deals beginning with the letter---
NSString* lSectionIndex = [NSString stringWithFormat:@"%i",[indexPath section]];
NSMutableArray *deals = [mIndexedOffersDic objectForKey:lSectionIndex];
if ([deals count]>0) {
//---extract the relevant deal from the deals array object---
Offer* lOffer = [deals objectAtIndex:indexPath.row];
[offerCell setOffer:lOffer];
offerCell.accessoryView = UITableViewCellAccessoryNone;
if (mTableView.dragging == NO && mTableView.decelerating == NO)
{
//Function : format image url to [email protected] and Initiate Image request download
//and set cache policy
[mListViewHelper InitImageRequest: lOffer.PromoImage indexPath: indexPath];
}
}
return offerCell;
这将有助于看到您的UITableView委托方法 – aryaxt 2011-12-15 05:08:06