Can someone point me to the method or info so I can read up on the alphabetical tableView separators that you find in the contacts list? I have seen them in a couple other programs and looked at the methods in the tableview thinking it would be there, but nothing stood out.
I first started to try to build something myself (code bellow) It was taking the first letter of a String at an index in my ClientArray, converting it to a Char and comparing the results. After tinkering for a hour I thought there had to be an easier way already made. The code is not done but this is what I was thinking. There must be a pre made solution for this? can I get any *'s in the right direction.
Thanks
I first started to try to build something myself (code bellow) It was taking the first letter of a String at an index in my ClientArray, converting it to a Char and comparing the results. After tinkering for a hour I thought there had to be an easier way already made. The code is not done but this is what I was thinking. There must be a pre made solution for this? can I get any *'s in the right direction.
Code:
int letterNum = 0;
int count = clientListForTable.count;
char currentLetter, arrayLetter;
NSArray *letters = [[NSArray alloc]initWithObjects:@"A",@"B",@"C",@"D", nil];
for (int i = 0; i < count; i ++) {
NSString *charLetter = [clientListForTable objectAtIndex:i];
currentLetter = [charLetter characterAtIndex:0];
NSString *getLetterFromArray = [letters objectAtIndex:letterNum];
arrayLetter = [getLetterFromArray characterAtIndex:0];
while (currentLetter != arrayLetter) { // Find first letter
letterNum++;
NSString *getLetterFromArray = [letters objectAtIndex:letterNum];
arrayLetter = [getLetterFromArray characterAtIndex:0];
}
[clientListForTable insertObject:[letters objectAtIndex:letterNum] atIndex:i];
}
Thanks