问题
My goal is to represent a tree hierarchy much like this:
Building
Zone
Floor
Room
... using a table view.
To accomplish this the design asks for each tree level to be embedded as its own Section
.
A .plain UITableView
is limited as it supports only one floating Section. Further research led me to create my own custom SectionView
, and placed it just below the navbar.
I've also strategized with marking certain rows
as my fake sections and playing with scrollViewDidScroll
also seems like the correct direction.
But am now perplexed in how to accomplish tracking the location of certain section cells, stacking them to float accordingly and animate scrolling correctly through each level section overlap.
To clarify, in my example below, the scrolling should stack like this:
Building <section>
Zone(s) <sub-section>
Floor(s) <sub-section>
Room(s) <rows>
Other tree formats also need to be supported:
Building <section>
Zone 1 <section>
Room <rows>
Zone 2 <section>
Room <rows>
Building <section>
Room <rows>
So the tree structure isn't fixed.
来源:https://stackoverflow.com/questions/49658938/how-can-i-add-more-floating-sub-sections-to-a-uitableview