ios - NSSortDescriptor NSDate ascending. How to sort objects with the same date? -


i using nsfetchedresultscontroller display objects event in list. event-object has property of startdate , eventtype property enum of types checkin, concert, meeting, flight, checkout. nsfetchedresultscontroller has sortdescriptor orders events startdate:

eventsrequest.sortdescriptors = [nssortdescriptor(key: "startdate", ascending: true)] 

this works fine, however, in cases startdate checkin event , meeting event same. confuses sortdescriptor , places meeting before checkin.

is possible make custom nssortdescriptor checks if startdate same, checks eventtype property , returns checkin before meeting?

sortdescriptors array, add additional nssortdescriptor second property wish, that:

eventsrequest.sortdescriptors = [nssortdescriptor(key: "startdate", ascending: true), nssortdescriptor(key: "eventtype", ascending: true)] 

this firstly use nssortdescriptor startdate , if same check value of eventtype


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -