I have
if (_sortedThemes == nil)
{
_sortedThemes = [[self.themes allKeys] sortedArrayUsingComparator:^NSComparisonResult(NSString *str1, NSString *str2)
{
if ([str1 isEqualToString:@"Default"] && str1 != str2)
{
return NSOrderedAscending;
}
else
{
return [str1 compare:str2];
}
}];
}
for (id d in _sortedThemes)
{
NSLog(@"%@",d);
}
_sortedThemes is indeed nil and the sorter returns:
Blue, … , Default , ….
I want Default as the first element, everything else in the regular order.
I changed to
if (([str1 isEqualToString:@"Default"] || [str2 isEqualToString:@"Default"]) && str1 != str2)
However, Default is still not the first element.
“Default” could also be str2. You need to add that case, then it probably works.