-2

Navigation controllers have a stack of view controllers. So, let us say the stack looks like this:

[Home, friends, highScores, Add, fullList]

Therefore I am currently on fullList, the top view Controller in the stack. Now if I do:

var stack = navigationController!.viewControllers
navigationController?.popToViewController(stack[1] as! UIViewController, animated: true)

i.e I pop to the view Controller called friends, does it also pop the view Controllers called highScores and add aswell or leave those and skip down into the stack?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
dan martin
  • 1,307
  • 3
  • 15
  • 29