【发布时间】:2013-01-11 13:30:21
【问题描述】:
在上下滚动 2 3 次后,此处的 tableview 将图像添加到所有单元格。代码如下:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
HomeCell *cell = (HomeCell *) [tableView dequeueReusableCellWithIdentifier:@"HomeCell"];
if (cell == nil) {
cell = [[HomeCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"HomeCell"] ;
}
VenueDC *venueObj = [subSubCategoriesArray objectAtIndex:indexPath.row];
cell.lblName.text = venueObj.name;
if ([venueObj.imagesArray count] > 0) {
[cell.ivVenue setImage:venueObj.ivVenue];
[cell.ivVenue setHidden:NO];
cell.lblName.frame = CGRectMake(80, cell.lblName.frame.origin.y, 200, cell.lblName.frame.size.height);
}
venueObj = nil;
return cell;
}
知道这里发生了什么吗?
图像仅在一个对象中,第一次加载时它会显示一个带有图像的单元格,但滚动后它也会开始在另一个单元格上显示图像。
【问题讨论】:
-
试试这个线程的答案,可能会对你有所帮助。 :stackoverflow.com/questions/10535637/…
标签: iphone ios uitableview