2

I have a custom subclass of NSView that is used in an NSCollectionView. The view shows a NSPopover when it is double clicked using the code below:

- (void)mouseDown:(NSEvent *)theEvent {
    [super mouseDown:theEvent];
    if ([theEvent clickCount] == 2) {
        [popover showRelativeToRect:[self bounds] ofView:self preferredEdge:NSMaxYEdge];
    }
}

popover is an IBOutlet (yes it's connected).

This works fine when the view is placed in a window normally, but when the view is in the collection view, it doesn't show.

[popover showRelativeToRect:[self bounds] ofView:self preferredEdge:NSMaxYEdge] is indeed called (I set a breakpoint) and no errors are logged.

Any ideas are appreciated.

cacau
  • 3,606
  • 3
  • 21
  • 42
spudwaffle
  • 2,905
  • 1
  • 22
  • 29

1 Answers1

0

Does the collection view accept input? If it does not accept first responder, then your subview won't see the click.

pickwick
  • 3,134
  • 22
  • 30