Set the NSSortDescriptor fr the lastCell to be ascending. After all, False (aka 0) comes before True (1).
Is it not possible to sort by a BOOL attribute, using NSSortDescriptor?
-
04-06-2022 - |
Вопрос
I need to sort the rows in my sections, from fetchedResultsController
.
I'm trying to make sure the Entity with lastCell attribute set to YES
, to be the last shown cell in it's section. Somehow it's always the first? Is this not possible?
Ordering from timeStamp is working great. lastCell
on the other hand doesn't seem to have any effect.
NSSortDescriptor *sortDescriptor1 = [[NSSortDescriptor alloc] initWithKey:@"timeStamp" ascending:NO];
NSSortDescriptor *sortDescriptor2 = [[NSSortDescriptor alloc] initWithKey:@"lastCell" ascending:NO];
Решение
Другие советы
What you might try is creating a simple custom comparison method to use. This question would be a good reference for that:
Не связан с StackOverflow