"popToViewController" 是否也弹出所有视图控制器?

Does "popToViewController" pop all the view controllers in between too?

导航控制器有一堆视图控制器。所以,假设堆栈看起来像这样:

[Home, friends, highScores, Add, fullList]

因此我目前在 fullList 上,堆栈中的顶层视图控制器。现在,如果我这样做:

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

即我弹出名为 friends 的视图控制器,它是否也弹出名为 highScores 的视图控制器并同时添加或留下它们并跳到堆栈中?

Pops view controllers until the specified view controller is at the top of the navigation stack.

是的。