Detect mouse being held down
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to be able to detect when a mouse is held down instead of clicked. This is what I have, but instead of a click count I want to be able to detect the mouse being held down. -(void)mouseDown:(NSEvent *)event; { //instead of clickCount I want my if statement to be // if the mouse is being held down. if ([event clickCount] < 1) { } else if ([event clickCount] > 1) { } } 回答1: Presumably you want to detect whether the mouse is being held down for a certain period of time. This is pretty straightforward; it just requires a timer. In