From the docs:
In the plain style, section headers and footers float above the content if the part of a complete section is visible. A table view can have an index that appears as a bar on the right hand sid开发者_开发百科e of the table (for example, "a" through "z"). You can touch a particular label to jump to the target section.
I find that very hard to grasp. First, this one:
if the part of a complete section is visible
What do they mean by this? This is paradox. Which one is it?
A) Table must be exactly the height of that section. If I have 5 Rows, and each row is 50px high, I must make it 5*50 high. The full section must be visible on the screen. Otherwise, if I have 100 rows but my table view is only 400 high, this will not apply. Nothing will float above my content. Sounds wrong.
B) It doesn't matter how high my table view actually is. Header and Footer is floating above the content and I can scroll the section. Makes more sense. But is completely against this nonsense making sentence: 'if the part of a complete section is visible'
And: What sense does it make when Section Headers / Footers float above the section content when there are multiple sections with Header / Footer? The user would have to scroll to death until reaching the end of first section, until the whole thing can move to the second section? Or could she drag the header / footer to move on?
Can anyone explain it better than they did?
It's easiest to explain through an example. Launch your Contacts app and scroll through your contacts. That's a UITableView with UITableViewStylePlain. The table has one section per letter. You can see the gray section headers "floating" above the table, meaning that once a section header reaches the top of the view, it remains in place while the table view scrolls underneath it. When the last cell from a section scrolls off the top of the view, the section header scrolls off the view along with it.
精彩评论