Q:

Searching in table view problem

Iam trying to searching data in the table view......
-(void)searchTableView{
    NSString *searchText=searchBar.text;
    NSMutableArray *searchArray=[[NSMutableArray alloc]init];
//  for (NSDictionary *dictionary in djList) {
//      NSLog(@"NSDictionary value is%@",dictionary);
////        NSArray *array = [dictionary objectForKey:@""];
////        [searchArray addObjectsFromArray:array];
//  }
    for (NSString *sTemp in searchArray) {
        NSRange titleResultsRange=[sTemp rangeOfString:searchText options:NSCaseInsensitiveSearch];
        if (titleResultsRange.length>0) {
        [copyListArray addObject:sTemp];
        }
    }
    [searchArray release];
    searchArray=nil;
}

There is problem in my commented lines....
I dont know what to do with ObjectForkKey:@"";
Is any other way out to work on this...... with out using NSDictionary....
@thanks in advance.

A:

Use of NSPredicate
 NSPredicate *annotationPredicate = [NSPredicate predicateWithFormat:@"(Latitudine = %@)AND(Longitudine = %@)AND(Name = %@) ",latitudeString,longitudeString,name];

SMutableArray *myArray = [[NSMutableArray alloc] initWithArray:sourceArray];
[myArray filterUsingPredicate:annotationPredicate];

The dictionary from the array must have the keys from array in this case "Latitudine", "Longitudine", "Name".
NSpredicate doc here. And look at the sample codes there.
Take a look at NSMutableArray doc
- (void)filterUsingPredicate:(NSPredicate *)predicate

