Re: NSComparisonResult
Re: NSComparisonResult
- Subject: Re: NSComparisonResult
- From: Steve Christensen <email@hidden>
- Date: Fri, 6 Feb 2004 07:31:27 -0800
On Feb 5, 2004, at 8:43 PM, April Gendill wrote:
Are there any examples of how to use NSComparisonResult with an array
of dictionaries when you only need to compare a single item in the
dict.
Sure:
int CompareDictionaries(id item1, id item2, void* context)
{
NSString* string1 = [item1 objectForKey:@"SomeKey"];
NSString*string2 = [item2 objectForKey:@"SomeKey"];
return [string1 localizedCaseInsensitiveCompare: string2];
}
...
- (void) sortArray
{
[myArray sortUsingFunction: CompareDictionaries context:nil];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.