在tableViewCell上运行动画会阻止用户交互? [英] Running animation on tableViewCell blocks user interaction?

查看:63
本文介绍了在tableViewCell上运行动画会阻止用户交互?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用动画制作tableViewCell的子视图.

I'm growing a subview of my tableViewCell in an animation.

UIView.animate(withDuration: TimeInterval(timeLeft), delay: 0, options: UIViewAnimationOptions.curveLinear, animations:  {


    var newFrame = self.viewToScale.frame;

    newFrame = CGRect(x: 0, y: newFrame.origin.y, width: newFrame.size.width + CGFloat(widthLeftToGrow) , height: newFrame.size.height)
    self.viewToScale.frame = newFrame


    }) 

我正在获取所需的动画,但是与我的单元进行交互变得非常不可靠.当我尝试滑动删除时,我不得不对其进行垃圾邮件处理,直到我似乎在非常特定的正确时间"滑动为止.

I'm getting the desired animation, but interacting with my cell has become very unreliable. When I'm trying to swipe to delete I have to spam it until I seemingly swipe at a very specific "right time".

我认为我需要在后台线程上运行它,但是在后台线程上更新UI是不正确的吗?

I would assume that I need to run this on a background thread, but updating the UI on the background thread is incorrect isn't it?

如何在不影响用户与单元交互的能力的情况下在tableViewCell上运行此动画?

How can run this animation on my tableViewCell without sacrificing the users ability to interact with the cell?

推荐答案

更改为:选项:UIViewAnimationOptions.AllowUserInteraction,

AllowUserInteraction

这篇关于在tableViewCell上运行动画会阻止用户交互?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆