I have an NSScrollView
wich is bound with an ArrayController
. I need to sort the content alphabetically. I've tried to do this with bindings but I can't find the right thing to bind. I used the following sortDescriptor
on my ArrayController
.
[myArrayController setSortDescriptors:[NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"myKey" ascending:YES selector:@selector(compare:)]]];
Do I miss a step in the process or am I not even close to sorting the content?
Did you try FilterPredicate ? this is a sample code:
NSDate *afterDate=[balanceDateAfter objectValue];
NSDate *beforeDate=[balanceDateBefore objectValue];
NSComparisonResult duration=[beforeDate timeIntervalSinceDate:afterDate];
duration=duration/3600;
duration=duration/24;
[checkInBalanceArray setFilterPredicate:[NSPredicate predicateWithFormat:@"(checkDate >= %@) AND (checkDate <= %@)", afterDate, beforeDate]];
[checkOutBalanceArray setFilterPredicate:[NSPredicate predicateWithFormat:@"(checkDate >= %@) AND (checkDate <= %@)", afterDate, beforeDate]];