Go back to previous view controller doesn't work

后端 未结 3 1829
名媛妹妹
名媛妹妹 2021-01-14 22:18

My first view controller has a button, which triggers the @IBAction goTo2ndVc() which presents a second ViewController:

class FirstVC: UIViewCon         


        
3条回答
  •  清酒与你
    2021-01-14 22:53

    If you want to return to the previous view controller, you can simply add:

    [self dismissViewControllerAnimated:YES completion:nil];
    

    to the button action method.

    If this is added on the nav view controller present on every screen, I see no reason why it shouldn't work as it would always dismiss the most recently presented view.

提交回复
热议问题