я могу обнаружить прикосновение CAShapeLayer как это (touchesEnded):CAShapeLayer обнаружить прикосновение во время анимации Swift
let touchLocation : CGPoint = (touch as! UITouch).locationInView(self.view)
for shape in shapes{
if CGPathContainsPoint(shape.path, nil, touchLocation, false){
print("Layer touch")
}
}
И я могу анимировать путь к CAShapeLayer так:
let newShapePath = UIBezierPath(arcCenter: toPoint, radius: 20, startAngle: CGFloat(0), endAngle: CGFloat(M_PI * 2), clockwise: true).CGPath
// animate the `path`
let animation = CABasicAnimation(keyPath: "path")
animation.toValue = newShapePath
animation.duration = CFTimeInterval(duration)
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn)
animation.fillMode = kCAFillModeBoth
animation.removedOnCompletion = false
shape.addAnimation(animation, forKey: animation.keyPath)
Но в то время как анимация происходит, касания не обнаруживаются на CAShapeLayer. Можно ли обнаружить прикосновение к CAShapeLayer во время анимации пути?