如何判断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);
    }
}

你可能感兴趣的:(如何判断UITableViewCell已经消失)