UITableView防止重用

来源:互联网 发布:网络上的梯子是什么 编辑:程序博客网 时间:2024/04/30 06:32
防止重用方法一:
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    替换为:
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; //根据indexPath准确地取出一行,而不是从cell重用队列中取出
     防止重用方法二:
     static NSString* cellIdentifier = @"cell";
     替换为:
     NSString *cellIdentifier = [NSString stringWithFormat:@"Cell%ld%ld", (long)[indexPath section], (long)[indexPath row]];
0 0