4 ms·
Something like this? https://stackoverflow.com/questions/9558335/filter-an-nsarray-which-contains-custom-objects https://stackoverflow.com/questions/9558335/fi
by melling 9y ago
Something like this?
https://stackoverflow.com/questions/9558335/filter-an-nsarray-which-contains-custom-objects https://stackoverflow.com/questions/9558335/filter-an-nsarra...
Food food1 = [Food alloc]initWithName:@"samsar" andId:@"1"];
Food food2 = [Food alloc] initWithName:@"rusaramar" andId:@"2"];
NSSarray array = [NSArray arrayWithObjects:food1, food2, nil];
[array filterUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary bindings) {
return [evaluatedObject.foodName hasPrefix:searchBar.text];
}];