Reputation: 2022
Perhaps you have seen the Facebook's iPhone app, and its slide-in menu.
When you scroll it up you can see that the headers of each group stop on top, until the next header takes its place. And vice-versa: by scrolling down, when the content of a group has appeared entirely, the header sticks to the group and starts scrolling with it, leaving the place for the upcoming header.
If anyone knows how is it done, please help. I don't know how this effect is called, I was googling but no result.
Any help (tut, link, code) is highly appreciated.
Thanks in advance
Upvotes: 0
Views: 383
Reputation: 9382
This effect (if I understand you correctly) is built into the UITableView
functionality- the method you're looking for is:
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
(Documentation for this method can be found here).
By giving your UITableView
a section header, you will enable the type of effect you see in apps like Phone (in the Contacts section).
To get headers that look like Facebook's as well, you can use
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
(Documentation for this method can be found here).
This function allows you to pass a custom view to the UITableView to use as a section header.
Upvotes: 1