Reputation: 3028
In my app I'm having some weird issues with UITableView
. Basically my tableview is made of two sections with 10 rows each. I can't get it to show floating section headers with section titles (like "Music" app showing a section for each letter of the alphabet for example).
I populated the tableView with some all-the-same cells for testing it but the table view won't show floating section headers, the only thing where I can see section titles (by the way "Anno 1" and "Anno 2" are the titles I need to show) is the bar on the right (is there anyway to hide this index bar?).
Can anybody help me in getting the tableview to show the section titles? Shouldn't it show them automatically or is there any property I must set in order to get them?
Upvotes: 2
Views: 838
Reputation: 3028
I just solved the problem! I was messing pretty badly with datasource methods. Basically the problem was that I thought that the method to set the section titles was:
This methods instead refers to the right bar for fast scrolling! The right method to use for setting the titles of the sections is this one:
here you return the title for the particular section passed as parameter.
Moreover if you don't override the first method I listed, the tableview won't show the bar for fast scrolling which in situations like the one I'm dealing with may be useful.
Upvotes: 1
Reputation: 6478
Is your table style "plain"? The headers don't float on style "grouped". Just a guess.
Also wondering if you are using custom section header views or just setting the section title.
Upvotes: 4