我为按钮绘制了圆形路径(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")
这是我输入的添加按钮的代码-
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)
这个按钮一直在循环移动。现在,当它移动时(当它移动时)我无法按下按钮。我只能在它处于原始位置时点击它。基本上,当按钮被动画连续移动时,我无法点击按钮。我可以在这里做什么?请帮忙。