【发布时间】:2016-01-28 18:24:18
【问题描述】:
我saw 和answers 的lot 关于这个topic,但不能解决我的特殊情况。
Here is a video with complete animation and logging timeline
class AnimationDelegate: UIView {
deinit {
print("AnimationDelegate deinitialized")
}
override func animationDidStart(anim: CAAnimation) {
print("animationDidStart")
}
override func animationDidStop(anim: CAAnimation, finished flag: Bool) {
print("animationDidStop")
}
func play() {
let line_1 = CAShapeLayer()
...
let animation = CABasicAnimation()
animation.delegate = self
animation.duration = 3000
animation.repeatCount = 1
animation.keyPath = "strokeEnd"
animation.fromValue = 0
animation.toValue = 360
layer.addSublayer(line_1)
line_1.addAnimation(animation, forKey: "StrokeAnimation")
}
}
let delegate = AnimationDelegate(frame: container.bounds)
container.addSubview(delegate)
delegate.play()
问题是animationDidStart 被调用,但animationDidStop 没有。
这怎么可能?
【问题讨论】:
-
编辑您的问题以包含配置
CABasicAnimation的代码。 -
@rob-mayoff 感谢您的请求。我已经完成了。
标签: ios swift core-animation calayer ios-animations