I\'m trying to mimic the behaviour of a table view similar to the iPod app for Artists - it\'s a sectioned table view with a section index on the right, with a search bar at the
Answered my own question, but might be helpful to other beginners:
Update: use the string constant UITableViewIndexSearch string in place of the undocumented string "{search}" - i.e. return it as one of the array items when implementing:
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
in UITableViewDataSource.
Put the search Controller in the beginning of the tableView and try this:
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
if (index==0){
[tableView scrollRectToVisible:CGRectMake(0,0,1,1) animated:NO];
return -1;
}
...
}
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
NSMutableArray * retValue =[NSMutableArray arrayWithArray:[YOUR ARRAY]];
[retValue insertObject:UITableViewIndexSearch atIndex:0];
return retValue;
}