我正在尝试利用CAMediaTiming Protocol在iOS上进行可取消的交互式转换。我已经成功实现了暂停和恢复UIView动画。但仍未能实现暂停和撤消UIView动画。这是我的代码:
撤消暂停的动画:
let layer = navigationController.transitionView.layer // the layer where animation takes place
let pausedTime = layer.timeOffset
layer.speed = -1.0
layer.timeOffset = 0
let timeSincePause = layer.convertTime(CACurrentMediaTime() ,fromLayer:nil) - (transitionDuration() - pausedTime)
layer.beginTime = timeSincePause