Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Add Section Index Title search in one section of UITableVIew in iPhone

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 717
    Comment on it

    Add Title search on UItableVIew

    - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
    

    {

    return [NSArray arrayWithObjects:@"A", @"B", @"C",@"D",@"E",@"F",@"G",@"H",@"I",@"J",@"K",@"L",@"M",@"N",@"O",@"P",@"Q",@"R",@"S",@"T",@"U",@"V",@"W",@"X", @"Y", @"Z", nil];

    } - (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index { for (int i = 0; i< [allnames count]; i++) { // Here you return the name i.e. Honda,Mazda // and match the title for first letter of name // and move to that row corresponding to that indexpath as below NSString *letterString = [[allnames objectAtIndex:i] substringToIndex:1]; if ([letterString isEqualToString:title]) { [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES]; break; } } }

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: