I can't understand why a CAShapeLayer does not respond to hitTest
This function always goes to // touches is outside
How do I detect a touch on a CAShapeLayer?
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
currentPoint = [[touches anyObject] locationInView:self];
for (CAShapeLayer *layer in self.layer.sublayers) {
if(layer == shapeLayer) {
if([layer hitTest:currentPoint])
{
// touche is on the layer
}
else {
// touche is outside
}
}
}
}