0

enter image description here

the relationship have show on the image,click the add button to add a item,then click the cell will show the PhotoListVC,i have set the segue between ListVC and PhotoListVC, it shouldn't allow me to add another segue with IB,and i have searched the internet,there was an resolved question,but it just has one segue,so how to pass data between ListVC and ListDetailVC when the 'Edit' Button has been clicked with already have one sugue?

   override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
    let edit = UITableViewRowAction(style: .normal, title: "Edit") {action in
       XXXXXXX  
    }
    edit.backgroundColor = UIColor.orange
}
rmaddy
  • 314,917
  • 42
  • 532
  • 579
wDalian
  • 49
  • 1
  • 8

1 Answers1

3

Obviously, you won't be able to drag a segue from the button itself, instead, you should perform a segue (from the view controller itself) when tapping the button:

 override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
    let edit = UITableViewRowAction(style: .normal, title: "Edit") {action in
        // like this:
        performSegue(withIdentifier: "yourIdentifier", sender: self)
    }
    edit.backgroundColor = UIColor.orange
}

If you are unfamiliar with adding a segue identifier or adding multiple segues, you might need to check this answer.

Ahmad F
  • 30,560
  • 17
  • 97
  • 143
  • but where to set the identifier ,i have already set one identifier on tableview cell – wDalian Aug 25 '17 at 01:52
  • the cell identifier, has nothing to do with the segue identifier, please check the [answer](https://stackoverflow.com/questions/39904328/xcode-where-to-assign-the-segue-identifier/39905378#39905378) that I already mentioned... – Ahmad F Aug 25 '17 at 02:35