Note that there are some explanatory texts on larger screens.

plurals
  1. POPopping viewcontroller and then back to RootViewController doesn't seem to work
    text
    copied!<p>I have an app that pushes four viewcontrollers on the stack. In the fourth view controller, I do a PopViewController, so I should be back at the 3rd viewcontroller, and in the viewWillAppear method, I do a PopToRootViewController. This does not get me back to the first viewcontroller correctly. The code is straightforward, just a </p> <pre><code>[self.navigationController pushViewController:nextController animated:YES] </code></pre> <p>in each of the first 3 viewcontrollers, and in the fourth</p> <pre><code>[self.navigationController popViewControllerAnimated:YES]. </code></pre> <p>In the 3rd viewcontroller, I have a viewWillAppear method which does:</p> <pre><code>[self.navigationController popToRootViewControllerAnimated:YES]. </code></pre> <hr> <p>As I go through the views, I get the following:</p> <p>Start app: </p> <pre><code> Back: Title: FirstLevel </code></pre> <p>Press OK: </p> <pre><code> Back: FirstLevel Title: SecondLevel </code></pre> <p>Press OK: </p> <pre><code> Back: SecondLevel Title: ThirdLevel </code></pre> <p>Press OK:</p> <pre><code> Back: ThirdLevel Title: FourthLevel </code></pre> <p>Press OK: which pops back 1 and then pops back to root:</p> <pre><code> Back: FirstLevel Title: ThirdLevel </code></pre> <p>If I press OK now:</p> <pre><code> Back: ThirdLevel Title: SecondLevel </code></pre> <p>I'm sorry if this is confusing. Should I be able to pop back one view controller and then immediately pop back to the root?</p> <p>Thanks for any help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload