确定点击了哪个CGPath

时间:2014-03-04 21:55:49

标签: ios objective-c uiview core-graphics

我正在寻找我称之为CGPathContainsPoint的反转。我在UIView中有一系列可点击的区域,如果用户点击,我需要找出用户点击的区域。

除了使用CGPathContainsPoint检查每个区域外,还有更好的方法来简单地确定点击了哪个CGPath吗?

谢谢!

1 个答案:

答案 0 :(得分:1)

if (CGPathContainsPoint(path, NULL, touchpositionInView, NO)){
BOOL PathContainsPoint = YES;
}

if (CGPathContainsPoint(path2, NULL, touchpositionInView, NO)){
BOOL Path2ContainsPoint = YES;
}
//...

我不知道这段代码有什么问题?

相关问题