Delegate Method to UItableViewCell Swift

前端 未结 3 778
Happy的楠姐
Happy的楠姐 2021-01-25 03:11

I have a Social Network Feed in form UItableView which has a cell. Now each cell has an image that animates when an even is triggered. Now, This event is in form of a string, wi

3条回答
  •  庸人自扰
    2021-01-25 03:42

    If I correctly understood your question, maybe this could help:

    class ViewController: UIViewController, YourCustomTableDelegate {
    
    @IBOutlet weak var tableView: YourCustomTableView!  
    
        override func viewDidLoad() {
            super.viewDidLoad()
            self.tableView.customTableDelegate = self
        }
    
    
        // table delegate method
        func shouldAnimateCell(at indexPath: IndexPath) {
           if let cell = tableView.cellForRow(at: indexPath) {
               cell.animate(...)
           }    
        }
    }
    

提交回复
热议问题