Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我将光标放在表格视图的单元格上时,我需要显示一个弹出框。在 OS X 应用程序上,当鼠标悬停在 NSTableViewCell 上时显示 NSPopover 的技术是什么?谢谢
mouseMoved:为您的表格视图实现消息并performSelector:withObject:afterDelay:从那里调用。NSObject:cancelPreviousPerformRequestsWithTarget:selector:object在执行此操作之前(以及在 dealloc 中)取消先前的请求。这将在鼠标移动时不断重新启动计时器。给定的选择器将在延迟结束后执行,此后鼠标未移动。在选择器中,您可以获取当前鼠标位置并显示弹出框。
mouseMoved:
performSelector:withObject:afterDelay:
NSObject:cancelPreviousPerformRequestsWithTarget:selector:object
当鼠标再次开始移动时,不要忘记删除弹出框。