Question

I'm setting up an edit window for a player to edit his user data. I've got all of the fields on the edit form bound to the appropriate Core Data entity (via an NSArrayController), and I've got an awakeFromNib method installed to handle calling the record, but I'm not sure what to put inside the method to get the record to display.

Ultimately, my goal with this is to set it up so that the application checks whether an entry exists for the user, and create one for him if there's no entry in the table.

Was it helpful?

Solution

You should look at using a NSObjectController or NSArrayController rather than binding directly to the NSManagedObject. The controllers work properly with bindings and your data will display nicely and changes you make will be propagated via the controller to your NSManagedObject.

You can set the object used by the controller in your awakeFromNib. On NSArrayController use the setSelectionIndex:(NSUInteger) index message and then to avoid empty selection send it the setAvoidEmptySelection:TRUE message

Hope that helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top