简体   繁体   中英

Multiple show segue from tableview cell in storyboard

Having a view controller on that I have a tableView with some sections. I want a multiple segue from the tableView cell. When I am creating a segue from the tableView in the storyboard the first segue is created properly but when I am going to create second segue the first one disappear. Is there any other way to do it?

Thanks in advance. This is updated question.

if segue.identifier == "segue" {
    let destVC = segue.destination as! AnotherVC
    let indexPath = tableView.indexPathForSelectedRow
    let cell = tableView.cellForRow(at: indexPath!) as! AnotherTableViewCell
    let valueToPass = cell.storeName.text
    destVC.storeName = valueToPass
} else if segue.identifier == "somesegue" {

}

Yes you need to create multiple segue from storyboard but attach them not to cell but from viewController. Give them names and in tableView didSelectRow method check for cell indexPath and call self.performSegueWithIdentifier("right identifier") and your viewController will make transition

You must link the ViewController1 to ViewController2 instead of a control in ViewController1 to ViewController2. See image below:

Segue Linking of ViewControllers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM