我有一个字典数组,我想找到键“guid”具有所需值的字典。 无法使用此代码获取它:
NSPredicate *filter = [NSPredicate predicateWithFormat:@"guid = %@", key];
NSArray *filteredContacts = [selectedValue filteredArrayUsingPredicate:filter];
最佳答案
试试这个。
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"Name CONTAINS[cd] %@",searchBar.text];
filterdArray = [[hospitalArray filteredArrayUsingPredicate:predicate] mutableCopy];
其中Name
是数组下字典中包含的key。
关于ios - 使用谓词在数组中搜索字典,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25759757/