我有一个表格视图,每个单元格中都有动画,动画是一个圆圈闪烁,但是滚动时,新行在不同的时间闪烁。想法是所有圆圈同时眨眼。
谢谢您的帮助。我有2天尝试不同的东西。最后是用计时器制作自己的动画,并将时间保存在全局变量中。但是我认为核心动画应该对此有所帮助。
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "myClassCell", for: indexPath) as! MyClassCell
cell.circleBlinking.alpha = 0
View.animate(withDuration: 1, delay: 0, options: [.repeat, .allowUserInteraction, .curveLinear], animations: {
cell.circleBlinking.alpha = 1} )
}
return cell
}
最后,我找到了满足要求的解决方案。我用计时器制作了动画。
如果有人知道如何做到这一点,欢迎您的回答。
我已经将代码和解决方案上传到了Github。