问题
I have a UITableView with 3 sections:
section 1: the header title of this section is "Players" and the cotent is exactly 1 cell containing a horizontal list of 1-4 players names.
section 2: the header title of this section is "Rounds" and the content is X cells each containing a horizontal list of each respective players score for round X.
section 3: the header title of this section is "Totals" and the content is exactly 1 cell containing the sum of each player's round scores.
Right now, all these sections scroll as section 2 expands with new rounds, but I want to always keep section 1 at the top of the screen, and have section 3 right below section 2, until it expands down to the bottom of the screen and then stop and stay there.
I guess I could do this with 3 separate table views inside a UIView but that seems kind of convoluted and I section 3 wouldn't stay right below section 2 until it expanded to the bottom of the screen; it would just always be at the bottom...
Is there a way to keep a table section/row always visible, and have the others still scrollable?
回答1:
Use 3 UITableViews as you discussed, and just animate the position of the Third tableview to move it down each time you add a cell to tableView 2, until it reaches the bottom of the screen then just leave it there. (Also you will need to expand the height of tableView 2 as you add elements to it.)
Otherwise, like Cyrille said, there is no way to implement that with one tableview only.
回答2:
Not with the standard UITableView implementation, no.
来源:https://stackoverflow.com/questions/11053222/uitableview-sections-to-always-stay-within-view