开发者

Adding a detail record in a master-detail window view

I'll preface with "Brand new to Cocoa" -- I hav开发者_如何学Pythone a master/detail page on my app: Students that may have one or several contacts (i.e. parents, relatives, etc). I have a Student entity and a Contact entity with a relationship field called "contact" in the Student entity and another relationship field called "student" in the Contact entity. The view has a TableView for the students and a TableView for the contacts with add and delete buttons to add a contact for the student that's highlighted in the table. There are NSArrayController objects called Students and Contacts to manage the entities. Students is bound to the File Owner (the NSDocument) ManagedObjectContext and the student name shows up fine in that TableView. The Contacts array controller Content Set is bound to Students.Selection.Contact (a relationship field in the Students entity.

The Add button is connected to the add: method in the Contacts array controller and the Delete button is bound to the remove: method in the Contact array controller. Clicking the Add button doesn't do anything -- and no errors on the log, so I'm not sure where the connection is missing. Any ideas?


I figured it out -- there was a binding missing :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜