user6820041
user6820041

Reputation: 1213

Running animation on tableViewCell blocks user interaction?

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".

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?

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

Upvotes: 0

Views: 58

Answers (1)

user5890979
user5890979

Reputation:

change to : options: UIViewAnimationOptions.AllowUserInteraction,

AllowUserInteraction

Upvotes: 3

Related Questions