back soft

مطالب مرتبط با «pass data from one activity to another» در back soft | نویسنده: استخدام کار

Pass data from a button in reused custom cell

Vote count: 0 I'm having trouble passing data from a custom cell by a user tapping a button in that custom cell. I sometimes get the wrong cells data since the cell is being reused. I was wondering if there was a full proof way to always get the right cell data to its button in each cell no matter which cell is currently on the screen. Below is my code. Any help is greatly appreciated. My Custom Cell: protocol CustomCellDelegate { func segueWithCellData() } class CustomTableViewCell : UITableViewCell { var delegate = CustomCellDelegate? @IBAction func buttonTapped() { if let delegate = self.delegate { delegate.segueWithCellData() } } } MyTableViewController: class MyTableViewController : UIT...

ادامه مطلب