Navigating back to main ViewController dismissViewControllerAnimated dilemma

后端 未结 1 465
野趣味
野趣味 2021-01-22 00:34

I have 2 ViewControllers directly connected with a push segue. I am navigating from first to second view controller by calling [self performSegueWithIdentifier:@\"segueIde

相关标签:
1条回答
  • 2021-01-22 01:06

    Yes,

    - (void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion
    

    is when a UIViewController is displayed modally.

    - (UIViewController *)popViewControllerAnimated:(BOOL)animated
    

    should do what you are seeking.

    So basically, in your second VC:

    [self.navigationController popViewControllerAnimated:YES];
    

    You will save you a lot of trouble if you read the UIViewController and UINavigationController references. Twice ;)

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