views:

39

answers:

0

I have an app I am working on that has 2 entities linked by a relationship (many to many). I currently have the app set up so that the rootviewcontroller controls the NSManagedObject (getting, setting, deleting of the data) in the first entity. When I drill down into on of the first entities it goes to a secondview (secondviewcontroller) that also has a table on. When I added a NSManagedObject on this view controller I got an error, which i figured to be because I then have 2 NSManagedObjects. I then resorted to referencing the rootviewcontroller's NSManagedObject which does allow me to get and display entities in the secondview, but since it is referencing the first view it brings back first entities, not second.

How do I manage to have 2 tables on 2 view that access data from entity 1 and entity 2 respectively. As a sidenote, how do I get NSPredicate to filter the results of clicking a row in table 1 to show only entity 2's that are related to the entity 1 that was clicked on.

Sorry for the massive explanation, but it is complicated (to me) and I need to figure it out as I have been doing this for over 3 days and no googling, books, blogs etc have gone into the detail I need! I must be missing something obvious!

Overview:

Entity 1: name relationship 1

Entity 2: name relationship 1;

rootviewcontroller: has NSManagedObject table populated with entity 1's

secondviewcontroller: has table that needs to be populated with entity 2's that are related to entity 1 clicked on

Currently the instance on rootviewcontroller that is in secondviewcontroller returns a list of entity 1's not 2's.

Thanks in advance guys :) I know I should post some code of what I have done so far, but as far as I can see what I have written must be wrong from the base up!