The array is roughly an object in it, which is sorted by a field date in the object, and displayed on tableview Online Based on the date size. Code
Array format: arry = [{Name: XXX, apply_date: 20121211}, {Name: XXX, apply_date: 20090815}, {Name: XXX, apply_date: 20111211}];
Nscomparisonresult compare (nsdictionary * firstdict, nsdictionary * seconddict, void * context) {If ([firstdict objectforkey: @ "apply_date"] integervalue] <[seconddict objectforkey: @ "apply_date"] integervalue]) return nsorderedascending; else if ([firstdict objectforkey: @ "apply_date"] integervalue]> [seconddict objectforkey: @ "apply_date"] integervalue]) return nsordereddescending; else return nsorderedsame ;}
Then we can call the above method to arrange it. Then we need to query the data in addition to the data and display it on the tablivew. We found a lot of duplicate data. The final reason is:
Nsstring * cellidentifier = [nsstring stringwithformat: @ "querycellid % d", indexpath. section, indexpath. row]; // nsstring * cellidentifier = @ "asdasdasdad"; <br> uitableviewcell * cell = [tableview dequeuereusablecellwithidentifier: cellidentifier];
we found that their indexpath needs to be added. row, indexpath. section, finally, we know that we need to [claimlist removeallobjects] before each query; after removing the array, we can make the query up-to-date. To sum up,