获取cell数组

//获取cell数组

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

    NSInteger sections = tableView.numberOfSections;

    NSMutableArray * cells = [NSMutableArray arrayWithCapacity:1];

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

        NSInteger rows = [tableView numberOfRowsInSection:i];

        NSMutableArray * sectionCells = [NSMutableArray arrayWithCapacity:1];

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

            NSIndexPath * indexPath = [NSIndexPath indexPathForRow:j inSection:i];

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

        }

        [cells addObject:sectionCells];

    }

    return [NSArray arrayWithArray:cells];

}

转载于:https://www.cnblogs.com/yujidewu/p/6957968.html