Programmatically go back to previous ViewController in Swift

前端 未结 15 1523
野的像风
野的像风 2020-12-04 04:50

I send the user over to a page on a button click. This page is a UITableViewController.

Now if the user taps on a cell, I would like to push him ba

15条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-04 05:30

    In the case where you presented a UIViewController from within a UIViewController i.e...

    // Main View Controller
    self.present(otherViewController, animated: true)
    

    Simply call the dismiss function:

    // Other View Controller
    self.dismiss(animated: true)
    

提交回复
热议问题