标签:
//MARK: 暂停layer上的动画 func pauseLayer(layer: CALayer) { let pausedTime: CFTimeInterval = layer.convertTime(CACurrentMediaTime(), fromLayer: nil) layer.speed = 0.0 layer.timeOffset = pausedTime } //MARK: 继续layer上的动画 func resumeLayer(layer: CALayer) { let pausedTime = layer.timeOffset layer.speed = 1.0 layer.timeOffset = 0.0 layer.beginTime = 0.0 let timeSincePause = layer.convertTime(CACurrentMediaTime(), fromLayer: nil) - pausedTime layer.beginTime = timeSincePause }
豆瓣电台笔记2:增加暂停/恢复歌曲的时候同时停止/恢复唱片上的动画
标签:
原文地址:http://www.cnblogs.com/sallet/p/5391265.html