Xcode 6 - Push segue to same view controller

前端 未结 3 1539
抹茶落季
抹茶落季 2021-01-18 02:04

I have a table view controller and tapping on a cell can trigger one of many different types of push segues based on the type of data in the cell. The identifier of the corr

3条回答
  •  天命终不由人
    2021-01-18 02:26

    Complemeting answer above you can do this in Swift 3 using:

     let vc = ViewController()          
     self.navigationController?.show(vc, sender: nil)
    

    If you are using storyboard you can use this:

    let vc = self.storyboard?.instantiateViewController(withIdentifier: "ViewControllerID") as! YourViewController
    self.navigationController?.show(vc, sender: nil)
    

提交回复
热议问题