I have a view that gets used in each of my CollectionView's items. I have an IBOutlet to the CollectionViewItem from my view and I have that hooked up in Interface Builder. I want to access a value from the representedObject (which is a Core Data object) in my view code. Here is an example of what I'm trying to do -- access a sequence value of the representedObject:
In the .h file:
IBOutlet NSCollectionViewItem *item; // Connected in IB
In the .m file
NSString *seq = [[item representedObject] valueForKey:@"seq"];
NSLog(@"Seq: %@", seq); // returns Seq: (null)
I know that the seq is populated because I have it binded to a label in the CollectionViewItem view in IB using the representedObject.seq key path and that works.
Any idea why when I try to access the value for seq in the code for the view it returns null?