Assuming that I have an array of custom objects, the custom class looks like this
Person ------- Name of the Name
Now we say that I want to rearrange the array of these objects that the number is sorted by the number of how it can be done. Could?
1) You must implement the following methods: your person
Class
- For starters in the (NSNumber *) number {return self.number; } - Compare (NSComparisonResult): (person *) person {compare [self number for start-up]]: [person number forting]]; }
2) When someone needs to sort the array, you simply call
a) Code > NSMutableArray <
[LogamelArose Sorting Selector: @Selector (compare)];
b) NSArray
NSArray * In the case of people sorted = [people are sorted by Array option selector @ Selector (comparison :));
Comments
Post a Comment