Mac Cocoa:要区分NSScrollWheel事件是来自鼠标还是触控板?

时间:2014-08-29 06:51:19

标签: objective-c macos cocoa

我找到了这个,但是如何传递NSEvent对象并调用此函数?

- (void)scrollWheel:(NSEvent *)theEvent
{      
    if(([theEvent momentumPhase] != NSEventPhaseNone) || [theEvent phase] != NSEventPhaseNone))
    {
      //theEvent is from trackpad           
    }
    else 
    {
       //theEvent is from mouse
     }
}

0 个答案:

没有答案