如何判断UITableViewCell已经消失

直接上代码了

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *cellIdentifiy = @"CELL";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifiy];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifiy];
    }
    cell.textLabel.text = _items[indexPath.row];
    [_set addObject:indexPath];
    NSLog(@"%@在唱歌", _items[indexPath.row]);
    return cell;
}

#pragma mark -
#pragma mark -UIScrollView delegate
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView
                  willDecelerate:(BOOL)decelerate {
    NSSet *visiblecells = [NSSet setWithArray:[self.contextView indexPathsForVisibleRows]];
    [_set minusSet:visiblecells];
    
    for (NSIndexPath *anIndexPath in _set) {
        UITableViewCell *cell = [self.contextView dequeueReusableCellWithIdentifier:@"CELL" forIndexPath:anIndexPath];
        NSLog(@"%@不在唱歌", cell.textLabel.text);
    }
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,179评论 25 708
  • 如果,其实本来就没有什么如果。 他是我在高中交的一个男朋友,对我特别的好,我很喜欢他,爱他。 第一次去了重庆读书,...
    糖shan阅读 224评论 0 1
  • 部门合并一个月了,今天用点时间进行个人复盘和反思。 早在四五个月前,我就提出来几个部门一起在一个办公室里办公,那个...
    拾面埋伏阅读 3,046评论 0 1
  • 一个人最无聊的时候,以及自己最孤独的时候,没有一个人和自己说,我自己也不愿意打扰太多的人,或者说,这一切都有代沟,...
    回首的背叛阅读 108评论 0 0
  • 最近在搞HTTPS,要升级三方库,发现cocoapods不能用了,cocoapods版本太低。闲时不抓紧,忙时就抓...
    devHornet阅读 220评论 0 0