我有一个自定义子类NSView
,用于NSCollectionView
. NSPopover
当使用以下代码双击视图时,该视图会显示:
- (void)mouseDown:(NSEvent *)theEvent {
[super mouseDown:theEvent];
if ([theEvent clickCount] == 2) {
[popover showRelativeToRect:[self bounds] ofView:self preferredEdge:NSMaxYEdge];
}
}
popover
是一个IBOutlet
(是的,它已连接)。
当视图正常放置在窗口中时,这可以正常工作,但是当视图位于集合视图中时,它不会显示。
[popover showRelativeToRect:[self bounds] ofView:self preferredEdge:NSMaxYEdge]
确实被调用(我设置了一个断点)并且没有记录错误。
任何想法表示赞赏。