Search code examples
iosswiftuiviewanimation

How to disable an UITableViewCell custom animation?


I have a custom animation for my table view done inside willDisplay delegate.
I want this animation to be disabled in one case, but I don't know how to do this.

I tried doing this in viewDidLoad:

UIView.setAnimationsEnabled(false)

But the animation is still performed. Any other way to disable animations on IOS ?


Solution

  • You can disable it yourself

    var enabled  = true
    
    func tableView(_ tableView: UITableView,willDisplay cell: UITableViewCell,forRowAt indexPath: IndexPath) {
    
          if enabled {
             // do animation
          }
          else {
    
          }
    
       }