Reputation: 1
I have created a tableview with 27 sections that are all alphabets, now what I need to do, I want to filter my data according to the sections, that means in section "A" I want all cell which start with alphabet "A".
Upvotes: 0
Views: 664
Reputation: 11
for(int i=0;i<[list count];i++){
NSString *newString;
NSString *mystring;
newString=[list1 objectAtIndex:i];
if( ( [newString characterAtIndex:0] == 'a' )||[newString characterAtIndex:0] == 'A' ){
// mystring = [newString substringFromIndex:0];
mystring=newString;
//[self.giftlist1 addObjectsFromArray:giftlist];
[self.listA addObject:mystring];
}
Upvotes: 1
Reputation: 3401
for (id alphabet in allSecionArray) {
if ([searchString hasPrefix:alphabet]) {
NSLog(@"Result is %@", searchString); // which you can add your result in your NSmutuable resultArray
}
}
Upvotes: 0