Wednesday, 15 July 2015

objective c - Sort NSMutableArray by date and then by alphabetical order -


I have an NSMutable array of objects that represent object football (soccer) matches and in this NSString parameter named title (Ed "Arsenal V Chelsea"), and a NSDate parameter is called ActualDate .

I am classifying array by wire at the following time using the following code:

  NSMutableArray * a = [self getMatchListFromURL: @ "http: //www.url .com "]; [Authors using a type: @ [[NSSSort Descriptor Sort Descriptor Withheets: @ "Actual Date" ascending: Yes]]];  

Obviously there are many games on the same date. I would like to sort games that will be alphabetical on the same date. Is there an easy way to do this?

method sorting descriptor takes the array as a code NSSortDescriptor you can follow many types of details according to the method:

  NSSortDescriptor * sortAlphabetical = [NSSortDescriptor sortDescriptorWithKey: @ "title: ascending: yes]; NSSortDescriptor * sortByDate = [NSSortDescriptor sortDescriptorWithKey: @ "ActualDate" ascending: Yes]; NSARRA * SortDiscuits = @ [sort alphabetical, sortbid]; // sorting [sorting descriptor: sort descriptor];  

No comments:

Post a Comment