This is freaking sweet:
- (NSString *)tableView:(UITableView *)tableView
titleForHeaderInSection:(NSInteger)section
{
return [[[UILocalizedIndexedCollation currentCollation] sectionTitles] objectAtIndex:section];
}
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
return [[UILocalizedIndexedCollation currentCollation] sectionIndexTitles];
}
- (NSInteger)tableView:(UITableView *)tableView
sectionForSectionIndexTitle:(NSString *)title
atIndex:(NSInteger)index
{
return [[UILocalizedIndexedCollation currentCollation] sectionForSectionIndexTitleAtIndex:index];
}
This is freaking sweet:
Localized scroll index that shows up on the right of a tableview. No need to create all the different arrays of localized sections.
Here's some code to make this a little more complete:
self.tableView.sectionIndexColor = [UIColor colorWithWhite:.5 alpha:1.0];
self.tableView.sectionIndexTrackingBackgroundColor = [UIColor colorWithWhite:.4 alpha:.2];
Got this from NSHipster