重新加载UITableView时,UITableViewCell内的CABasicAnimation停止

时间:2016-11-08 18:52:59

标签: ios swift uitableview cabasicanimation

我在CABasicAnimation的{​​{1}}方法中创建awakeFromNib,如下所示:

UITableViewCell

但是当我使用class TableviewCell: UITableViewCell { @IBOutlet weak var viewToAnimate: UIView! override func awakeFromNib() { super.awakeFromNib() let hoverBasicAnimation = CABasicAnimation(keyPath: "position") hoverBasicAnimation.isAdditive = true hoverBasicAnimation.fromValue = NSValue(cgPoint: CGPoint(x: 0, y:self.viewToAnimate.frame.origin.y)) hoverBasicAnimation.toValue = NSValue(cgPoint: CGPoint(x:0, y: self.viewToAnimate.frame.origin.y + 30.0)) hoverBasicAnimation.autoreverses = true hoverBasicAnimation.duration = 5 hoverBasicAnimation.repeatCount = Float.infinity self.viewToAnimate.layer.add(hoverBasicAnimation, forKey: "hover animation") } } 进行“拉动刷新”重新加载UITableView时,动画停止。

如何在刷新/重新加载UIRefreshControl时阻止动画停止?

0 个答案:

没有答案