On Jun 15, 2016, at 21:23 , John Chacho <[email protected]> wrote:
> 
> If not, how can I add an arbitrary new record into the dictionary?

If I understand correctly, you have to go the long way round for this scenario 
(which is not specific to NSDictionaryController). Instead of connecting your 
Add button to the standard “add:” action of the NS…Controller, you must instead 
create a custom action method, e.g. ‘addEntry:’. In this method, you’ll need to 
get hold of the current selection (if that’s where the "based on” values come 
from), verify that it’s suitable for creating a new entry, create the entry, 
then add the new entry to your data model dictionary KVO compliantly — or use 
the NS…Controller’s ‘addObject:’ method, which causes a KVO compliant update. 
(Both ways are equally easy for an underlying NSDictionary, since it provides 
KVO compliance for free, but it can be slightly harder for other underlying 
collection types.)

In effect, the above is exactly what the ‘add:’ action method does, except that 
it can’t customize the data model object it creates to add.

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to