0

Here i am using popover to a new ViewController from my UITableVIewCell button click but i am getting this error Main.storyboard: Couldn't compile connection: property=anchorView destination=>

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    if(tableView == self.table_view_one) {
        var cell  = table_view_one.dequeueReusableCell(withIdentifier: "first_cell", for: indexPath) as! first_cell
       cell.first_view_time_btn.addTarget(self, action: #selector(Iop_gonio_ViewController.someAction), for: .touchUpInside)
       return cell
    }
}

func someAction() {
    self.performSegue(withIdentifier: "first_time_btn", sender: self)
}
Harshal Valanda
  • 5,331
  • 26
  • 63
asif saifi
  • 166
  • 1
  • 11

1 Answers1

0

try

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if(tableView == self.table_view_one) {
    var cell  = table_view_one.dequeueReusableCell(withIdentifier: "first_cell", for: indexPath) as! first_cell
   cell.first_view_time_btn.addTarget(self, action: #selector(someAction(sender:)), for: .touchUpInside)
   return cell
}

func someAction(sender:UIButton) {
    self.performSegue(withIdentifier: "first_time_btn", sender: self)
}

But I don't think it is a nice method, you should create a protocol handling such interaction.

Samson Wong
  • 226
  • 2
  • 10