Instance Method

compareObject:toObject:

Returns a comparison result value that indicates the sort order of two objects.

Declaration

- (NSComparisonResult)compareObject:(id)object1 toObject:(id)object2;

Parameters

object1

The object to compare with object2. This object must have a property accessible using the key-path specified by key.

object2

The object to compare with object1. This object must have a property accessible using the key-path specified by key.

Return Value

NSOrderedAscending if object1 is less than object2, NSOrderedDescending if object1 is greater than object2, or NSOrderedSame if object1 is equal to object2.

Discussion

The ordering is determined by comparing the values specified by key of object1 and object2 using the selector specified by selector.

See Also

Using Sort Descriptors

reversedSortDescriptor

Returns a sort descriptor with the sort order reversed.

- allowEvaluation

Forces a sort descriptor that was securely decoded to allow evaluation.