Wednesday, November 2, 2022
HomeiOS Developmentios - How can i do know when default capabilities animations end?

ios – How can i do know when default capabilities animations end?


In my software, i listed delivered notifications as sorted by date in tableView. If consumer faucet to notifications from machine notification display, app highlights row. However earlier than consumer presses notification on machine principal display, if customers scroll in direction of the top of the tableView, when consumer presses notification, app scrolls the tableView to the row with as an animated and in addition highlights the row.

But when customers scrolled contentView to finish of the tableView, spotlight shouldn’t be working. I feel scroll to row animation perform and spotlight animation perform working at identical time.

How am i able to catch when tableView.scrollToRow(at: indexPath, at: .backside, animated: true) animation completed. If i do know when scrollToRow animation end, i can run spotlight row code after.

Thanks.

 DispatchQueue.principal.async {
      self.tableView.scrollToRow(at: indexPath, at: .backside, animated: true)
      
      if let cell = self.tableView.cellForRow(at: indexPath) as? NewsItemCell {
        
        let highlightView = UIView.init(body: cell.contentView.body)
        highlightView.backgroundColor = .white
        highlightView.alpha = 0.0
        cell.contentView.addSubview(highlightView)
        print(indexPath)
        
        UIView.animate(withDuration: 1.0, delay: 0, choices: .curveEaseIn) {
          highlightView.alpha = 1.0
          
        } completion: { Bool in
          UIView.animate(withDuration: 1.5, delay: 0, choices: .curveEaseOut) {
            highlightView.alpha = 0.0
          } completion: { Bool in
            highlightView.removeFromSuperview()
          }
        }
      }
    }

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments