Instance Method

sortUsingSelector:

Sorts the receiver in ascending order, as determined by the comparison method specified by a given selector.

Declaration

- (void)sortUsingSelector:(SEL)comparator;

Parameters

comparator

A selector that specifies the comparison method to use to compare elements in the array.

The comparator message is sent to each object in the array and has as its single argument another object in the array. The comparator method should return NSOrderedAscending if the array is smaller than the argument, NSOrderedDescending if the array is larger than the argument, and NSOrderedSame if they are equal.

See Also

Rearranging Content

- exchangeObjectAtIndex:withObjectAtIndex:

Exchanges the objects in the array at given indexes.

- sortUsingDescriptors:

Sorts the receiver using a given array of sort descriptors.

- sortUsingComparator:

Sorts the receiver in ascending order using the comparison method specified by a given NSComparator block.

- sortWithOptions:usingComparator:

Sorts the receiver in ascending order using the specified options and the comparison method specified by a given NSComparator block.

- sortUsingFunction:context:

Sorts the receiver in ascending order as defined by the comparison function compare.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software