Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'pizzaSegue'

后端 未结 1 1250
梦谈多话
梦谈多话 2021-01-15 03:16

I am new to swift programming and running into errors with performing a segue from a tableview cell when it is pressed to a view controller giving details about that cell. T

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-15 03:28

    From your comment:

    . I have a button in the tabBarController that presents the tableView and this is working fine.

    let drinkController = DrinkListTableViewController() 
    let drinkNavigationController = UINavigationController(rootViewController: drinkController) 
    self.present(drinkNavigationController, animated: true, completion: nil)
    

    No it isn’t working fine. It is the problem.

    Basically this is the same situation as in my answer here:

    https://stackoverflow.com/a/40077530/341994

    You are obtaining a useless instance when you say DrinkListTableViewController(). What you need to do is talk to the storyboard and ask it to instantiate the desired view controller (by identifier) so that you get the instance from the storyboard, the one that has the segue.

    0 讨论(0)
提交回复
热议问题