Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dismiss two modal view controllers

I have a navigation controller which present one modal viewController. From inside this modal viewController I present another modal viewController. All I want is to get back from the last modal viewController to the navigationController (the root viewController).Something similar with popToRootViewController, but adapted for modalViewControllers;

NavigationController -> present Modal ViewController A -> present Modal ViewController B

From modal ViewCOntroller B I want to return to navigationCOntroller.

Is this possible?

Appreciate, Alex.

like image 541
Alexandru Circus Avatar asked Feb 10 '11 10:02

Alexandru Circus


People also ask

How do I switch between view controllers?

Right-click the control or object in your current view controller. Drag the cursor to the view controller you want to present. Select the kind of segue you want from the list that Xcode provides.

How can you reload a ViewController after dismissing a modally presented view controller in Swift?

Swift 5: You can access the presenting ViewController (presentingViewController) property and use it to reload the table view when the view will disappear. When you dismiss the SecondViewController, the tableview of the FirstViewController will reload. In my case, presentingViewController is SecondViewController.


1 Answers

Problem solved :)

I tried

[self.parentViewController.parentViewController dismissModalViewControllerAnimated:YES];    

and works.

Thanks.

like image 55
Alexandru Circus Avatar answered Oct 13 '22 00:10

Alexandru Circus