Sort NSScrollView, NSTableView content using binding in ArrayController

I have a NSScrollViewrelated to ArrayController. I need to sort the contents in alphabetical order. I tried to do this with bindings, but I cannot find the desired binding. I used sortDescriptoron mine ArrayController.

[myArrayController setSortDescriptors:[NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"myKey" ascending:YES selector:@selector(compare:)]]];

Skip any step in the process or am I not even close to sorting the content?

0
source share
2 answers

Please check this project ... which uses an array controller and does a search and sort. Without large codes, uses bindings.

+1
source

Have you tried FilterPredicate? this is an example 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]];
0

All Articles