获取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];

}

posted on 2017-06-07 17:00  雨季的雾  阅读(187)  评论(0编辑  收藏  举报