How to navigate to a UITableView position by the cell it's title using indexing
        Posted  
        
            by 
                BarryK88
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by BarryK88
        
        
        
        Published on 2012-07-02T20:01:45Z
        Indexed on 
            2012/07/03
            9:15 UTC
        
        
        Read the original article
        Hit count: 234
        
I'm using a UITableView filled with a around 200 cells containing a title, subtitle and thumbnail image. I want to a have a selection method just like within the contact App from Apple where you can select a character from the alphabet.
I'm at the point where I've drawn the selection interface (A,B,C etc), and via it's delegate I'm retrieving the respective index and title (i.e: A = 1, B = 2, C = 3 etc.).
Now I want to navigate to the first cell, where the first character of the cell it's title is starting with the selected index character. Just like the contacts App.
Can someone give me a direction for how to implement such functionality.
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
I filled my sectionIndex by means of
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
    if(searching)
        return nil;
    NSMutableArray *tempArray = [[NSMutableArray alloc] init];
    [tempArray addObject:@"A"];
    [tempArray addObject:@"B"];
    [tempArray addObject:@"C"];
    [tempArray addObject:@"D"];
    [tempArray addObject:@"E"];
    [tempArray addObject:@"F"];
    [tempArray addObject:@"G"];
    [tempArray addObject:@"H"];
    [tempArray addObject:@"I"];
    [tempArray addObject:@"J"];
    [tempArray addObject:@"K"];
    [tempArray addObject:@"L"];
    [tempArray addObject:@"M"];
    [tempArray addObject:@"N"];
    [tempArray addObject:@"O"];
    [tempArray addObject:@"P"];
    [tempArray addObject:@"Q"];
    [tempArray addObject:@"R"];
    [tempArray addObject:@"S"];
    [tempArray addObject:@"T"];
    [tempArray addObject:@"U"];
    [tempArray addObject:@"V"];
    [tempArray addObject:@"W"];
    [tempArray addObject:@"X"];
    [tempArray addObject:@"Y"];
    [tempArray addObject:@"Z"];
    return tempArray;
}
        © Stack Overflow or respective owner