How to present a second ViewController & amp; Reject first

advertisements

using the following code in the parent ViewController, I want to present a second view ontop of the first, then dismiss the first:

// Animates the next questionViewController using the first questionViewController
[previousView presentViewController:nextQuestionViewController animated:YES completion:nil];

// Dismiss the first questionViewController
[previousView dismissViewControllerAnimated:NO completion:nil];

When run, the second view is presented, but the first view will not dismiss.


You would need to first dismiss the "previousView" & then present the "nextQuestionViewController":

// Dismiss the first questionViewController
[previousView dismissViewControllerAnimated:NO completion:nil];

// Animates the next questionViewController using the first questionViewController
[previousView presentViewController:nextQuestionViewController animated:YES completion:nil];