iOScell 重用解决办法

来源:互联网 发布:ape进销存电商erp源码 编辑:程序博客网 时间:2024/06/06 20:49

 有时我们项目里使用tableview时会出现cell重用现象,那是因为cell被放到一个重用池里,后面的cell在创建时就会拿这个池子里cell,,,上代码   

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {        IndexDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:[NSString stringWithFormat:@"Celld%ld", (long)[indexPath row]]];    if (cell == nil) {        cell = [[IndexDetailCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[NSString stringWithFormat:@"Celld%ld", (long)[indexPath row]]];        cell.mode = self.dataSourse[indexPath.row];    }        return cell;    }


0 0
原创粉丝点击