我在我的 NSImageView 上画了一条 NSBezierPath 线。我正在创建 NSBezierPath 对象、设置moveToPoint、设置lineToPoint、设置setLineWidth:,然后在drawRect我NSImageView调用的子类中创建[myNSBezierPath stroke]。这一切都像我想要的那样工作,但我似乎无法使用containsPoint:方法......我尝试实现
if([myNSBezierPath containsPoint:[theEvent locationInWindow]]{
//do something
}
在-(void)mouseUp:(NSEvent*)theEvent我的 NSImageView 子类中,但它从来没有反应,我确定我正在触及那条线......我做错了什么吗?我只需要检测 NSBezierPath 是否被点击。
干杯。