Iphone UITableViewCell重复图像

Iphone UITableViewCell重复图像,iphone,uitableview,Iphone,Uitableview,我正在尝试在表格视图单元格中添加收藏夹图像。我正在使用这个代码 static NSString *CellIdentifier = @"memberCell"; MemberCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; NSDictionary *item = self.searchList[indexPath.row]; cell.memberFullName.text = [i

我正在尝试在表格视图单元格中添加收藏夹图像。我正在使用这个代码

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"]];
}
静态NSString*CellIdentifier=@“memberCell”;
MemberCell*cell=[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSDictionary*item=self.searchList[indexPath.row];
cell.memberFullName.text=[item[@“full_name”]大写字符串];
cell.memberPosition.text=[item[@“title”]长度]<1?[NSString stringWithFormat:@“%@”,项目[@“地区”]:[NSString stringWithFormat:@“%@,%@”,项目[@“标题”],项目[@“地区”];
cell.memberRoom.text=[NSString stringWithFormat:@“Rm%@”,项目[@“房间号”];
[cell.memberImage setImageWithURL:[NSURL URLWithString:item[@“image_thumb”]]
占位符图像:[UIImage ImageName:@“占位符”]];
如果(![item[@“fid”]isEqualToString:@“0”]){
[cell.memberFavoriteImage setImage:[UIImage ImageName:@“收藏夹”];
}
我遇到的问题是,即使条件(![item[@“fid”]isEqualToString:@“0”])仅为1个单元格传递,最喜欢的图像仍显示在多个单元格上,当我执行
NSLog
时,条件只传递一次,但图像显示是系统顺序(即每第9行),当我向下滚动并返回时,顺序完全改变,图像显示在不同的行中。我不确定发生了什么,请帮忙

NSString*CellIdentifier=[NSString stringWithFormat:@“%d_%d”,indexath.section,indexath.row];
NSString *CellIdentifier = [NSString stringWithFormat:@"%d_%d",indexPath.section,indexPath.row];
    MemberCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[MemberCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: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"]];
    }

    return cell;
MemberCell*cell=[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 如果(单元格==nil){ cell=[[MemberCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } NSDictionary*item=self.searchList[indexPath.row]; cell.memberFullName.text=[item[@“full_name”]大写字符串]; cell.memberPosition.text=[item[@“title”]长度]<1?[NSString stringWithFormat:@“%@”,项目[@“地区”]:[NSString stringWithFormat:@“%@,%@”,项目[@“标题”],项目[@“地区”]; cell.memberRoom.text=[NSString stringWithFormat:@“Rm%@”,项目[@“房间号”]; [cell.memberImage setImageWithURL:[NSURL URLWithString:item[@“image_thumb”]]占位符图像:[UIImage ImageName:@“placeholder”]; 如果(![item[@“fid”]isEqualToString:@“0”]){ [cell.memberFavoriteImage setImage:[UIImage ImageName:@“收藏夹”]; } 返回单元;
出列指令可能返回单元格的现有实例

试试这个

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *CellIdentifier = [NSString stringWithFormat:@"%d_%d",indexPath.section,indexPath.row];
    MemberCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[MemberCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: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"]];
    } else {
        [cell.memberFavoriteImage setImage:nil];
    }

    return cell;
}
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{
NSString*CellIdentifier=[NSString stringWithFormat:@“%d_%d”,indexPath.section,indexPath.row];
MemberCell*cell=[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
如果(单元格==nil){
cell=[[MemberCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
NSDictionary*item=self.searchList[indexPath.row];
cell.memberFullName.text=[item[@“full_name”]大写字符串];
cell.memberPosition.text=[item[@“title”]长度<1?[NSString stringWithFormat:@“%@”、item[@“districts”]:[NSString stringWithFormat:@“%@、%@”、item[@“title”]、item[@“districts”];
cell.memberRoom.text=[NSString stringWithFormat:@“Rm%@”,项目[@“房间号”];
[cell.memberImage setImageWithURL:[NSURL URLWithString:item[@“image_thumb”]]占位符图像:[UIImage ImageName:@“placeholder”];
如果(![item[@“fid”]isEqualToString:@“0”]){
[cell.memberFavoriteImage setImage:[UIImage ImageName:@“收藏夹”];
}否则{
[cell.memberFavoriteImage setImage:nil];
}
返回单元;
}