NSCollectionView中的NSPopover(或不) [英] NSPopover in NSCollectionView (or not)

查看:107
本文介绍了NSCollectionView中的NSPopover(或不)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个NSView的自定义子类,该类在NSCollectionView中使用. 使用以下代码双击该视图会显示NSPopover:

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];
    }
}

popoverIBOutlet(是已连接).

当视图正常放置在窗口中时,此方法工作正常,但是在集合视图中时,该视图不显示.

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]确实被称为(我设置了一个断点),并且未记录任何错误.

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

任何想法都值得赞赏.

推荐答案

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

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

这篇关于NSCollectionView中的NSPopover(或不)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆