-1
我有這樣的NSMutableArray
。如何在NSDictionary對象數組中找到鍵ios
[
{
"Employee": {
"EmployeeCode": 17125,
"DisplayName": "MI0000026 - ABC",
"DisplayName2": "ABC2",
"Initials": "W. S. S.",
"Surname": "CCC",
"FirstName": "ABC",
"MiddleName": "CDE",
"LastName": "",
"FullName": "ABC EMPLOYEE",
},
"LeaveDetail": {
"LeaveDetailId": 21,
"LeaveEntryCode": 16,
"RequestId": 20,
"EmployeeCode": 17125,
"LeaveYear": 2016,
"LeaveTypeCode": 1,
"BaseType": "ess",
"LeaveDate": "2016-09-05T00:00:00",
}
}
]
這個數組中有幾個對象有這些類型的字典。我想查找此數組中有"LeaveDate": "2016-09-05T00:00:00"
的所有對象,此LeaveDate鍵位於LeaveDetail
字典中。我怎樣才能找到所有具有LeaveDate作爲對象 「2016-09-05T00:00:00」
編輯 NSPredicate *predicate=[NSPredicate predicateWithFormat:@"LeaveDate CONTAINS[cd] %@",dm.strClickedDate];
但是,我沒有得到任何結果。
請幫幫我。 由於
的[從NSArray的其中詞典鍵具有值X檢索的NSDictionary](可能的複製http://stackoverflow.com/questions/15831183/retrieve-nsdictionary-from-nsarray-where-dictionary-key- has-value-x) – Droppy
請在發帖之前進行搜索。 – Droppy
這是不一樣的,我有兩種類型的對象,,我已經嘗試過這樣。 NSPredicate * predicate = [NSPredicate predicateWithFormat:@「LeaveDate CONTAINS [cd]%@」,dm.strClickedDate];但我沒有得到任何結果。這就是爲什麼我發佈這 – Irrd