【发布时间】:2018-02-13 03:36:33
【问题描述】:
我正在我的视图中绘制一条描边路径。我正在尝试查看描边路径是否包含特定点。但是它的 contains 方法不会检测该点是否在描边路径中。
func checkCollision(currentPoint:CGPoint) -> CustomShape?{
for shape in customShapes {
//Check if current shapes uibezierpath contains a point
if (shape.path.contains(currentPoint)) {
return shape
}
}
return nil
}
【问题讨论】:
-
我们可以看看一些代码吗?
-
您的意思是... a) 该点位于封闭路径内,b) 该点在过去某个时间以编程方式添加到路径中...或 c) 该点理论上完全正确与路径相交?
-
@BooberBunz 点与路径相交。
标签: ios swift mobile uibezierpath