TableViewCell animation in swift

后端 未结 6 603
囚心锁ツ
囚心锁ツ 2021-02-04 15:54

I am following THIS tutorial and achieve that animation with this code:

func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtInd         


        
6条回答
  •  感情败类
    2021-02-04 16:24

    Use this code to achieve animation in your tableview

    func tableView(_ tableView: UITableView, willDisplay cell:
        UITableViewCell, forRowAt indexPath: IndexPath) {
        let rotationAngleInRadians = 360.0 * CGFloat(.pi/360.0)
      //  let rotationTransform = CATransform3DMakeRotation(rotationAngleInRadians, -500, 100, 0)
        let rotationTransform = CATransform3DMakeRotation(rotationAngleInRadians, 0, 0, 1)
        cell.layer.transform = rotationTransform
        UIView.animate(withDuration: 1.0, animations: {cell.layer.transform = CATransform3DIdentity})
    }
    

提交回复
热议问题