views:

71

answers:

1

I have an NSCollection view. I want to connect a control in the replicated view either to an outlet my controller, passing in the representedObject, or to an outlet on the representedObject itself. Can I do this with IB or do I need to do this programmatically?

+2  A: 

Your usage of the words action/outlet is a little confusing. Actions connections can be made in IB that cause a certain selector to be called on another object in your nib. Outlets create a connection to another object in the nib that can be used in code.

If I understand correctly, you're asking "can I connect the action of a control in my prototype view to one of the outlets of the controller?" If that's literally what you meant, then what's the point of going through the controller? Just connect the action of the control to the same object that your controller's outlet is connected to.

It's possible you mean "can I connect the action of a control in my prototype view to a controller object in my nib?" then, the answer is yes. NSCollectionView should correctly copy action connections when replicating the prototype NSCollectionViewItem.

If you meant something else, please clarify.

kperryua
Sorry, I'm still learning terminoogy, so I apologize if I've bungled things.Yes, I do mean "can I connect the action of a conrtol in my prototype view to one of the outlets of the controller", but I also need to pass in the representedObject associated with the NSCollectionViewItem -- or at least access it from outlet defined in my controller.The other option doesn't involve connecting an action to an outlet in the controller -- I was talking about connecting it to an outlet on the representedObject -- but I don't have any "representation" of that in IB.
andrew