how to retrieve all visible table section header views

后端 未结 10 588
渐次进展
渐次进展 2020-12-31 04:44

is there a way to get all the section header views that are visible?

something similar to UITableView\'s visibleCells instance method..

10条回答
  •  爱一瞬间的悲伤
    2020-12-31 05:17

    A quick look at the UITableView documentation gives us the indexPathsForVisibleRows and combining it with map gives us the array we need:

    tableView.indexPathsForVisibleRows.map{ tableView.headerView(forSection: $0.section) }
    

    map returns the array of our visible headers-in-section.

提交回复
热议问题