Not tested, but I think you want something like this:
Create a NSDictionary
property called titleReference
.
Initialize it when you first create your controller
self.titleReference = [NSDictionary dictionaryWithObjectsAndKeys:
@"PATH OF TRAVEL", @"POT",
@"ANNUAL PASSIVE", @"Ann",
@"AUDIT", @"Aud",
@"CONTRACTOR AUDIT", @"CA",
nil];
Use it to populate an array that matches the one you've created.
-(NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
NSArray *keys = [[self.sections allKeys] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
NSMutableArray *titles = [NSMutableArray arrayWithCapacity:[keys count]];
for (NSString *key in keys) {
NSString *title = [self.titleReference objectForKey:key];
if (title) {
[titles addObject:title];
} else {
[titles addObject:key];
}
}
return titles;
}