TableViewCell animation in swift

后端 未结 6 602
囚心锁ツ
囚心锁ツ 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 Animate Tableview cell from left

        func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
    
        let rotationTransform = CATransform3DTranslate(CATransform3DIdentity, -200, 0, 0)
        cell.layer.transform = rotationTransform
        cell.alpha = 0.5
    
        UIView.animate(withDuration: 0.5){
            cell.layer.transform = CATransform3DIdentity
            cell.alpha = 1.0
        }
    }
    

提交回复
热议问题