SHARE
TWEET

Untitled

a guest Jun 16th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  2.         let cell = tableView.dequeueReusableCell(withIdentifier: "cellID", for: indexPath)
  3.         cell.button.tag = indexPath.row
  4.         cell.button.addTarget(self, action: Selector("buttonAction:"), for: .touchUpInside)
  5.  
  6.         // other cell element setup
  7.         return cell
  8.     }
  9.      
  10. func buttonAction(sender: UIButton) {
  11.     let data = tableArray[sender.tag]
  12.     // logic to pass present detailVC
  13. }
  14.      
  15. // Set The Click Action On Button
  16.     cell.bProfileImage.addTarget(self, action: #selector(connected(sender:)), for:
  17.          .touchUpInside)
  18.     cell.bProfileImage.tag = indexPath.row
  19.      
  20. // Function For TouchUpInside For Cell
  21. @objc func connected(sender: UIButton) {
  22.     let data = individualChatsListArray[sender.tag]
  23.     print(data.name)
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top