0

I modally called my terms and conditions screen from my root controller as follows:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *uiViewController = [storyboard instantiateViewControllerWithIdentifier:@"splashViewController"];
[uiViewController setModalPresentationStyle:UIModalPresentationCustom];
[uiViewController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentViewController:uiViewController animated:YES completion:nil];

The following is how the modal view returns to the root view.

[self.navigationController popViewControllerAnimated:NO];
[self dismissViewControllerAnimated:YES completion:nil];

The modal view can create other modal views but when the user returns from the that view, he/she returns to the root view and the terms and conditions view and the views created from it should disappear from history.

How can I return to the main (root) view from views created from the terms and conditions view so that the app forgets about all views modally created.

Sandah Aung
  • 6,156
  • 15
  • 56
  • 98

1 Answers1

1

If I'm reading your question correctly, you want:

[self.navigationController popToRootViewControllerAnimated:NO];

That'll pop you back to your root view.

Endareth
  • 492
  • 3
  • 15
  • I was thinking if [this](http://stackoverflow.com/questions/10213321/ios-dismiss-two-viewcontroller) is the answer to my question. Does your answer have the same effect as the answer I have found? – Sandah Aung Jul 03 '15 at 03:23
  • Same result I think, but because you're using a UINavigationController, it's a lot easier. – Endareth Jul 03 '15 at 03:25