NSDictionary Controller and Table Sort

I have an NSTableView whose content is provided by an NSDictionaryController, with the 2 columns bound to the controller’s arrangedObjects.key and arrangedObjects.value. I need to be able to sort the key column by a caseInsensitiveCompare. I’m not sure whether this can be done in IB, and if so, how. Should I be doing that with the sort key and selector of the table column --I’ve tried this, but I can’t figure out what the sort key should be. Or, should I be doing it with the sort descriptor bindings of the dictionary controller?



create an autoreleased NSSortDescriptor object with the appropriate compare selector in the awakeFromeNib method of the AppDelegate class and assign it to the controller, for example

	NSSortDescriptor *caseInsensitiveDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"key" ascending: YES selector: @selector(caseInsensitiveCompare:)] autorelease];
	[dictionaryController setSortDescriptors: [NSArray arrayWithObject: caseInsensitiveDescriptor]];	

or bind the SortDescriptor key of the controller to an array property in the AppDelegate class whose getter returns
the descriptor array

I’m pretty sure you can do it in IB – use caseInsensitiveCompare: with a sort key of key.