我有一個NSMutableArray
。它有8個對象。每個對象具有這樣如何搜索複雜的NSMutableArray上的東西
{
"Attendance": {},
"Shift": {},
"DayType": {},
"DayTypes": null,
"TotalOvertimeString": "06:00"
},
而這個「出席」的另一字典5鍵值對。正是這樣的
"Attendance": {
"AttendanceCode": 5058,
"Date": "2016-02-01T00:00:00",
"EmployeeCode": 2941,
"ShiftCode": 1,
"DayTypeCode": 1,
"Expected": true,
"Midnight": false,
"Present": true,
"InTime": "2016-02-01T08:00:00",
"InTimeString": "08:00",
"OutTime": "2016-02-01T20:00:00",
"OutTimeString": "20:00",
"OutDate": "2016-02-01T00:00:00",
"InTime2": "1901-01-01T00:00:00",
"InTime2String": "00:00",
"InDate2": "1901-01-01T00:00:00",
"OutTime2": "1901-01-01T00:00:00",
"OutTime2String": "00:00",
"OutDate2": "1901-01-01T00:00:00",
"ApprovedOutTimeUsed": 0,
"ApprovedOutTime": "1901-01-01T00:00:00",
"Late": 0,
"LateString": "00:00",
"InLate": 0,
"InLateString": "00:00",
"MidLate": 0,
"MidLateString": "",
"OutLate": 0,
"OutLateString": "00:00",
"InOvertime": 0,
"InOvertimeString": "",
"OvertimeRate1": 6,
"OvertimeRate1String": "06:00",
"OvertimeRate1Approved": 0,
"OvertimeRate1ApprovedString": "00:00",
"OvertimeRate2": 0,
"OvertimeRate2String": "00:00",
"OvertimeRate2Approved": 0,
"OvertimeRate2ApprovedString": "00:00",
"OvertimeRate3": 0,
"OvertimeRate3String": "00:00",
"OvertimeRate3Approved": 0,
"OvertimeRate3ApprovedString": "00:00",
"OvertimeRate4": 0,
"OvertimeRate4String": "00:00",
"OvertimeRate4Approved": 0,
"OvertimeRate4ApprovedString": "00:00",
"OvertimeRate5": 0,
"OvertimeRate5String": "00:00",
"OvertimeRate5Approved": 0,
"OvertimeRate5ApprovedString": "00:00",
"OvertimeRate6": 0,
"OvertimeRate6String": "00:00",
"OvertimeRate6Approved": 0,
"OvertimeRate6ApprovedString": "00:00",
"OvertimeApprovalDone": false,
"Lieu": false,
"LieuFirstTaken": false,
"LieuSecondTaken": false,
"LieuPayment": 0,
"DayOff": false,
"DayOffTaken": false,
"LeaveTypeCode": 0,
"LeaveAmount": 0,
"LeaveTypeCode2": 0,
"LeaveAmount2": 0,
"ShortLeaveAmount": 0,
"Premium": 0,
"PremiumString": "00:00",
"PremiumApproved": 0,
"PremiumApprovedString": "00:00",
"Missing": 0,
"MissingString": "00:00",
"ClockNumber": 0,
"SectionCode": 0,
"WorkHours": 0,
"PeriodWorked": 0,
"WorkHrs": 0,
"Remarks": "uuuuuuuuuuuuuuus",
"Deleted": false,
"Status": true,
"CreatedBy": 0,
"CreatedDate": "1901-01-01T00:00:00",
"UpdatedBy": 9,
"UpdatedDate": "2016-01-13T22:48:03.737",
"DeletedBy": 0,
"DeletedDate": "1901-01-01T00:00:00"
},
我想要做的就是找到這個確切的日期值是否可用在這個陣列"Date": "2016-02-01T00:00:00"
如何搜索這個日期是否可用在這陣?請幫幫我。
由於您知道數組元素的結構,因此可以使用多種方法遍歷數組中的所有元素,例如'enumerateObjectsUsingBlock'。如果您的目標是找到一個方便的方法來判斷整個數組中是否有日期,我建議您將該數組轉換爲JSON字符串,並且可以將它看作一個長字符串,並且很容易找到結果。 – childrenOurFuture