Cocoa - array not sorting?
Posted
by Mike
on Stack Overflow
See other posts from Stack Overflow
or by Mike
Published on 2010-03-17T14:46:27Z
Indexed on
2010/03/17
16:11 UTC
Read the original article
Hit count: 409
I have this set
NSMutableSet *mySet = [NSMutableSet setWithObjects: @"2", @"8", @"7", @"0", @"3", nil];
I copy the set to an array and sort it using
NSArray *sortedArray = [[mySet allObjects] sortedArrayUsingSelector:@selector(compare:)];
The resulting array is in exactly the same order as the set and is not being sorted. Why?
thanks for any help.
EDIT: CORRECING A TYPO.
© Stack Overflow or respective owner