How to pop back to a view in a different navigation controller?

限于喜欢 提交于 2019-12-06 05:30:30

If you are using storyboards, you can do this using an unwind segue.

In VC1 implement an @IBAction method, which takes a UIStoryboardSegue as parameter:

@IBAction func unwindToVC1(sender: UIStoryboardSegue) {

}

Then from the Prototype cell of VC3 control-drag to the Exit icon of the view controller, select Selection Segue: unwindToVC1: and you are good to go.

You can achieve a similar result using code also.
Implement didSelectRowAtIndexPath in VC3 like this:

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    navigationController!.dismissViewControllerAnimated(true, completion: nil)
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!