Core Data and Cocoa Binds
First of all, I'm fairly new to programming with Cocoa. With that said, I am writing a scoreKeeping application for softball. Eventually I want to put it on the iPhone, but I'm starting out just on the Mac.
Basically I want the program to keep stats for multiple players on multiple teams. Core data makes this pretty easy. I have an entity for Team and an entity for Players. There is a to-many relationship between the two (which is inverse also). I have two PopUpButtons. One shows the teams. The other shows the players that are on the team selected on the other button. Cocoa bindings make the first one very easy. I set up an Array controller that is hooked up to the ManagedObjectContext and holds Team entities. Great. Then I bind the pop up button to the teamName of that ArrayController. Very simple. If I do the same thing for the Players, it will display all of the players in the whole app. Not just the players on the team selected. I know there is a FilterPredicate on the ArrayController that will solve this for me. I just don't know how to set it up. I understand how to make predicates (I use them when I fetch stuff from core data), but I don't know how to bind it. Also it needs to update everytime I switch the team selected, so that would require some observer hand shaking.
I think this very simple example really shows the power of cocoa. Laying something out like this would be very helpful to a lot of people I'm sure.
Please help if you can!
Thanks in advance!