On Jan 30, 2012, at 12:32 AM, Seth Willits wrote: > Say I have a file type popup in a save sheet for saving an image: > > @property NSString * fileType; > > - (NSArray *)fileTypes > { > return [NSArray arrayWithObjects:(id)kUTTypeJPEG, (id)kUTTypePNG, > (id)kUTTypeTIFF, nil]; > } > > - (NSArray *)fileTypeNames > { > return [NSArray arrayWithObjects:@"JPEG", @"PNG", @"TIFF", nil]; > } > > The popup should display the names, but I want the selected item bound to > fileType which is one of the UTIs. By my reading of the documentation, this > _should be very simple_. > > Bind: > content -> fileTypes* > contentValues -> fileTypeNames > selectedObject -> fileType
The contentValues and contentObjects, if bound, must be bound to an extension of the key path that content is bound to. It doesn't work with two separate arrays like that. You can make fileTypes an array of dictionaries, where each dictionary has a "uti" key and a "displayName" key. Then, you can bind like so: content -> fileTypes contentValues -> fileTypes.displayName contentObjects -> fileTypes.uti selectedObject -> fileType The purpose of the contentObjects binding is so that the selectedObject gets the UTI string and not the dictionary from the fileTypes array (i.e. the value from the content binding). If you're fine with having it be the dictionary, you don't have to bind contentObjects. Regards, Ken _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com