I have a NSCollectionView (OS X, not iOS) bound to my model. Each collection view item has a button and a label. I'm handling the click actions and I have the sender and event arguments but I unable to distinguish one button from the others. Most other questions not dealing with Collection Views say to use the tag property, but this isn't exposed on the Interface Builder's bindings tab. There is an Argument and Argument2 bindings, but they dont seems to correspond to the tag property in the objc code and I don't know how to otherwise access these Arguments.
-(void)image_click:(id)sender forEvent:(NSEvent *)event
{
NSButton *btn = sender;
NSLog(@"image clicked, %ld", (long)btn.tag); //image clicked, 0
}
How do I differentiate between buttons in Objective-C code inside the click actions of a bunch of buttons in a collection view?