2
Для таблицы выпадающего списка поиска мне нужно показать «Описание» и «SearchTerms» в ячейке текстовой метки и подробной текстовой метки соответственно. Мне нужно реализовать фильтр, который основан на двух строках. Текст поиска должен сравниваться с «Описание» и «SearchTerms». Я попытался NSPredicate, но он может фильтровать для одной строки толькофильтр-массив словарей с двумя строками
NSString *substring = [NSString stringWithString:searchServiceTextField.text];
NSLog(@"substring %@",substring);
NSMutableArray *arr2Filt= [searchArray valueForKey:@"Description"];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF contains[c] %@",substring];
NSArray *filteredarr = [NSMutableArray arrayWithArray:[arr2Filt filteredArrayUsingPredicate:predicate]];
NSLog(@"filtered array %@",filteredarr);
я попытался изменить для обеих строк, но я не получил более soultion.
[{
Description = "Rental Jewellery, Jewellery for events";
ProfessionId = "<null>";
SKUFormat = "<null>";
SearchTerms = "Rental Jewellery";
SpecialityId = 62;
tokens = "<null>";
value = "<null>";
},
{
Description = "Kids Party with Food and Games Venues";
ProfessionId = "<null>";
SKUFormat = "<null>";
SearchTerms = "Party Venue";
SpecialityId = 63;
tokens = "<null>";
value = "<null>";
},
{
Description = "Music, Dance, Sports classes";
ProfessionId = "<null>";
SKUFormat = "<null>";
SearchTerms = Classes;
SpecialityId = 64;
tokens = "<null>";
value = "<null>";
},
{
Description = "Zumba, Yoga, Aerobics classes";
ProfessionId = "<null>";
SKUFormat = "<null>";
SearchTerms = "Fitness/Health";
SpecialityId = 65;
tokens = "<null>";
value = "<null>";
}
]