0
喜的朋友我正在顯示圖像的表格單元格說表有10個細胞UIITabelViewCell顯示不正確的圖像
,但我只在兩種細胞
顯示圖像時,我滾動表視圖此圖像由一個上再來一個所有細胞
所以我在這裏做錯了什麼。
static NSString * identifier = @「CellTypeLabel」;
// create custom cell
CustomizedTableCells* cell = nil;
if (cell == nil)
cell = [[[CustomizedTableCells alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier] autorelease];
// cell accessory type
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.imageView.image = nil;
NyhtrAppDelegate *appDelegate = (NyhtrAppDelegate *)[[UIApplication sharedApplication] delegate];
NSXMLElement* node = [appDelegate.items objectAtIndex:indexPath.row];
NSLog(@"\n Output :: %@ :: ", [node XMLString]);
// set the lable name for a cell
if(node != NULL)
{
int width = cell.contentView.bounds.size.width-50;
if([[[node elementForName:@"pubDate"] stringValue]length] > 0)
[cell setCellWithTitleAndSize:[[node elementForName:@"title"] stringValue] rect:CGRectMake(45, 0, width, 35) size: 17];
else
[cell setCellWithTitleAndSize:@"N/A" rect:CGRectMake(45, 0, width, 35) size: 17];
}
NSXMLElement* iconElement = [self getIconElementForThisDomain:[self getDomain:node]];
NSString* iconImageUrl = nil;
if (nil != iconElement)
iconImageUrl = [[iconElement elementForName:@"retina-icon"]stringValue];
else
iconImageUrl = @"http://nyhtr.se/icon/nyheter24.png";
// cached images
NSString* imageName = [[UICachedImageMgr defaultMgr] imageNameFromURLString:iconImageUrl];
UIImageProxy* imageProxy = [UICachedImageMgr imageWithName:imageName userInfo:self];
cell.imageView.image = imageProxy.image;
return cell;
您有錯誤的(最有可能的)cellForRowAtIndexPath:方法。有沒有機會看到你的代碼指向錯誤? – Vladimir 2011-02-09 12:04:16
編輯你的問題並把你的代碼放在它裏面......在這段代碼中,你將圖像設置到單元格中了嗎? – Vladimir 2011-02-09 12:10:23