我有一个带有标签和两个图像视图的NSTableCellView
。当我单击标签或图像视图时,没有调用鼠标事件。尽管添加了子视图,有什么方法可以在视图中调用鼠标事件(在我的情况下为鼠标向下)?下面是我的获取鼠标按下事件的代码,
class TableCellView: NSTableCellView {
override func mouseDown(with event: NSEvent) {
super.mouseDown(with: event)
}
}
当我单击视图时,此方法有效。但是,如果我单击视图的子视图标签(NSTextField)或图像视图(NSImageView),则无法正常工作。