1

I'm preparing a graph plot application,and i need to detect the touch of the user on the drawn lines using drawRect() method and show an alert message to user with the values at that point. I have drawn the lines using NSBezierPath. Is there any way to detect the touch only on the lines ,not at any other places of screen?

4

1 回答 1

1

我认为唯一要做的就是检测绘制线的初始点和最终点并添加约束,以便 touch 不会提供除 line 之外的任何值。这可以使用矩形概念来完成,绘制的线将是矩形的对角线,我们可以根据矩形和它的对角线放置约束。

于 2013-06-10T09:00:12.657 回答