2017-09-20 25 views
0

我试图显示新的tableview单元格,每个单元格之间出现一个简短的暂停,以便用户可以清楚地看到新行已添加到退出的tableview中。我尝试过不同的动画时间下面的代码,但它不工作。使用暂停生成新的tableview单元格

self.tableView.reloadData() 

func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { 
     UIView.animate(withDuration: 24.8, animations: { 
     cell.contentView.alpha = 24.0 
     } 
    } 
+1

你为什么要设置'alpha'到24?它需要是一个范围在0.0到1.0之间的值。而alpha已经设置为1.0,所以将它设置为1.0将不会做任何有用的事情。 – rmaddy

回答

0

试试这个:

UIView.animate(withDuration: 0.3, 
          delay: 0.5, 
          options: .curveEaseInOut, 
          animations: { 
       //Animation code..... 
}, 
          completion: nil)