iOS   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – 如果我为tableview单元设置动画,则表格视图滚动不会停止大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图在tableview单元格中添加动画,动画工作正常.但是当我试图通过点击它不停止来阻止tableview的滚动.通常在滚动的tableview中,如果我们点击屏幕,滚动就会停止.但是,当我添加这些不起作用的动画时.下面是我用于动画的代码

func tableView(tableView: UITableView,willDisplayCell cell: UITableViewCell,forRowATindexPath indexPath: NSIndexPath) {
    let rotationTransform = CATransform3DScale(CATransform3DIdentity,0.4,0)

    cell.layer.transform = rotationTransform
    UIView.animateWithDuration(0.5) { () -> Void in
        cell.layer.transform = CATransform3DIdentity
    }
}

解决方法

注意:

这是使用animateWithDuration …方法之一的动画的正常行为.如果您想在动画期间进行用户交互,您可以尝试下面我已经显示内容.

只需要尝试这样:

func tableView(tableView: UITableView,0)
    cell.layer.transform = rotationTransform

    UIView.animateWithDuration(0.5,delay: 0.5,options: UIViewAnimationOptions.AllowUserInteraction,animations: { () -> Void in
        cell.layer.transform = CATransform3DIdentity
        },completion: nil)
}

希望它对你有所帮助.

大佬总结

以上是大佬教程为你收集整理的ios – 如果我为tableview单元设置动画,则表格视图滚动不会停止全部内容,希望文章能够帮你解决ios – 如果我为tableview单元设置动画,则表格视图滚动不会停止所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。