I ended up creating a subclass NSViewto use as a representation for CollectionViewItem. There I installed a delegate (connected to IB) and used it to catch the right mouse click and open the menu:
-(void)rightMouseDown:(NSEvent *)theEvent {
NSMenu *menu = [self.delegate menuForCollectionItemView:self];
[menu popUpMenuPositioningItem:[[menu itemArray] objectAtIndex:0]
atLocation:NSZeroPoint
inView:self];
}
It still needs some code to position the menu the user clicked on, but this is the start.
If anyone has a cleaner method, I would like to hear it.
source
share