我为按钮绘制了一个圆形路径(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)
此按钮继续以圆圈移动。现在,我不能在按钮移动时按下按钮(当它移动时)。我只能在它处于原始位置时点击它。基本上,我不能通过动画连续移动按钮。我能在这做什么?请帮忙。