【问题标题】:NSPopover in NSCollectionView (or not)NSCollectionView 中的 NSPopover(或没有)
【发布时间】:2011-08-10 04:58:36
【问题描述】:

我有一个NSView 的自定义子类,用于NSCollectionView。 使用以下代码双击视图时,该视图显示NSPopover

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

popoverIBOutlet(是的,它已连接)。

当视图正常放置在窗口中时,这可以正常工作,但是当视图在集合视图中时,它不会显示。

[popover showRelativeToRect:[self bounds] ofView:self preferredEdge:NSMaxYEdge] 确实被调用(我设置了一个断点)并且没有记录任何错误。

感谢任何想法。

【问题讨论】:

    标签: objective-c cocoa nsview nscollectionview nspopover


    【解决方案1】:

    集合视图是否接受输入?如果它不接受第一响应者,那么您的子视图将看不到点击。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-21
      相关资源
      最近更新 更多