Ped*_*ira 5 macos cocoa objective-c nsevent mousedown
我必须按照代码来捕获mouseDown自定义的 s NSView,但我认为这只捕获了多少次点击(使用 )clickCount,而不是捕获了多少根手指被点击:
- (void)updateTrackingAreas{
if(trackingArea != nil) {
[self removeTrackingArea:trackingArea];
}
int opts = (NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways);
trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds]
options:opts
owner:self
userInfo:nil];
[self addTrackingArea:trackingArea];
}
- (void)mouseDown:(NSEvent *)theEvent{
NSLog(@"%li",theEvent.clickCount);
if ([theEvent clickCount] == 3){
NSLog(@"3");
}else{
NSLog(@"normal");
}
}
Run Code Online (Sandbox Code Playgroud)
关于如何在我的自定义 NSView 上用 3 个手指捕捉 1 次点击,有什么想法吗?我想重现类似 Finder.app 选项的内容,您可以用 3 个手指点击文件,然后会显示一个 QuickLook 面板。
谢谢!
| 归档时间: |
|
| 查看次数: |
657 次 |
| 最近记录: |