I have four viewcontrollers A , B , C and D
i go from A to B to C to D
let newViewContoller: B = self.storyboard?.instantiateViewControllerWithIdentifier("B") as! B
self.presentViewController(newViewContoller, animated: true, completion:nil)
To go back from D to A
I am using the following
self.view.window!.rootViewController?.dismissViewControllerAnimated(true, completion: nil)
The problem that I am facing is,
viewDidAppear
of viewController B and viewController C is being called.
I do not know why is that happening? What is the right way of going back to initial UIViewController
.