How do you find the actual layer that was hit?
At the moment I have numerous CAShapeLayers
, and I want each one to do something when it is tapped. But when any one of them is tapped, an action happens to all of them.
This is my code so far:
if shape.hitTest(point) != nil {
shape.lineWidth = 60
}
if shape1.hitTest(point) != nil {
shape1.lineWidth = 60
}
if shape2.hitTest(point) != nil {
shape2.lineWidth = 60
}
This probably means that it is only checking to see if the point tapped is a CAShapeLayer
. How do you get it to check if the point tapped is a specific CAShapeLayer
?