小编Dee*_* ML的帖子

UITableViewCell重复图像

我想在表格视图单元格中添加收藏夹图像.我正在使用此代码

static NSString *CellIdentifier = @"memberCell";
MemberCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSDictionary *item = self.searchList[indexPath.row];

cell.memberFullName.text = [item[@"full_name"] uppercaseString] ;
cell.memberPosition.text =  [item[@"title"] length] < 1 ? [NSString stringWithFormat:@"%@",  item[@"districts"]] : [NSString stringWithFormat:@"%@, %@", item[@"title"], item[@"districts"]];
cell.memberRoom.text = [NSString stringWithFormat:@"Rm %@", item[@"room_number"] ];
[cell.memberImage setImageWithURL:[NSURL URLWithString:item[@"image_thumb"]]
                 placeholderImage:[UIImage imageNamed:@"placeholder"]];

if(![item[@"fid"] isEqualToString:@"0"]) {
    [cell.memberFavoriteImage setImage:[UIImage imageNamed:@"favorite"]];
}
Run Code Online (Sandbox Code Playgroud)

我遇到的问题是最喜欢的图像显示在多个单元格上,即使条件if(![item[@"fid"] isEqualToString:@"0"]) 只传递给1个单元格,当我这样做时NSLog,条件只传递一次,但显示的图像是一个系统的顺序(即每个第9个行),当我一直向下滚动并返回时,顺序完全改变,图像显示在不同的行中.我不确定发生了什么,请帮忙.

iphone uitableview

0
推荐指数
1
解决办法
1410
查看次数

标签 统计

iphone ×1

uitableview ×1