iOS遍历TableView 上所有Cell

- (NSArray *)cellsForTableView:(UITableView *)tableView{

    NSInteger sections = tableView.numberOfSections;

    NSMutableArray *cells = [[NSMutableArray alloc] init];

    for (int section = 0; section < sections; section++) {

        NSInteger rows = [tableView numberOfRowsInSection:section];

        for (int row = 0; row < rows; row++) {

            NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section];

            [cells addObject:[tableView cellForRowAtIndexPath:indexPath]];

        }

    }

    return cells;

}

目前还没有测试能不能得到复用池中的Cell

发布了49 篇原创文章 · 获赞 7 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/qq_29680975/article/details/100985953