gpt4 book ai didi

objective-c - -(BOOL)trackMouse :inRect:ofView:untilMouseUp: Is never invoked

转载 作者:行者123 更新时间:2023-12-03 17:22:52 25 4
gpt4 key购买 nike

我对 NSControl 进行了子类化以获得自定义控件, 对 NSCell 进行子类化以获得我的自定义单元格, 重写 -(BOOL)trackMouse:inRect:ofView:untilMouseUp 和必要的方法 在自定义单元格中, 已覆盖 customControl 中的 + (Class)cellClass 以返回我的 customCell,

单元格在控件上绘制良好,设置启用、设置禁用效果很好,但是 鼠标事件没有被触发。 在调试时我注意到 -(BOOL)trackMouse:inRect:ofView:untilMouseUp: 从未被调用。根据“控制和单元编程指南”-

"Controls manage the behavior of their cells. By inheritance from NSView, controls derive the ability for responding to user actions and rendering their on-screen representation. When users click on a control, it responds in part by sending trackMouse:inRect:ofView:untilMouseUp: to the cell that was clicked"

请告诉我是否遗漏了一些东西 - 我在谷歌上搜索了很多,但没有找到任何有用的东西。

最佳答案

关于objective-c - -(BOOL)trackMouse :inRect:ofView:untilMouseUp: Is never invoked,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16708801/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com