I have drawn a circular path for a button (scienceCircle)-
var sciencePath = UIBezierPath()
sciencePath.moveToPoint(CGPoint(x: 228, y: 132))
sciencePath.addCurveToPoint(CGPoint(x: 228, y: 132), controlPoint1: CGPoint(x: 208, y: 153), controlPoint2: CGPoint(x: 248, y: 114))
let anim2 = CAKeyframeAnimation(keyPath: "position")
anim2.path = sciencePath.CGPath
anim2.repeatCount = Float.infinity
anim2.duration = 7.0
scienceCircle.layer.addAnimation(anim2, forKey: "animate position along path")
This is the code I typed to add the button-
var scienceCircle = InterestSubCircles() //A Cocoa Touch Class with a drawRect method to make the button a circle.
scienceCircle.frame = CGRect(x: 183, y: 137, width: 100, height: 100)
self.view.addSubview(scienceCircle)
This button keeps on moving in circles. Now, I cannot press the button when it is moving (when it is displaced). I can only tap it when it is in it's original position. Basically, I cannot tap the button when it is being displaced continuously by the animation. What can I do here? Please help.