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