How to get a UITableView's visible sections?

前端 未结 12 1757
轻奢々
轻奢々 2020-12-14 19:24

UITableView provides the methods indexPathsForVisibleRows and visibleCells, but how can I get the visible sections?

12条回答
  •  醉梦人生
    2020-12-14 20:24

    for (NSUInteger section = 0; section < self.tableView.numberOfSections; ++section) {
        UIView *headerView = [self.tableView headerViewForSection:section];
        if (headerView.window) {
            NSLog(@"its visible");
        }
    }
    

提交回复
热议问题