Reputation: 156
I'd like to know if there's any difference between pushing and poping a UIViewController.
Upvotes: 1
Views: 2883
Reputation: 3892
Think of the navigation stack as a stack of plates. You start with one plate. If you put another plate on top of the first plate, thats push
ing. You can do that over and over if you want. You can even put the same plate on top of itself. Then when you want to go back one class, that is take one plate off the stack, you are pop
ing. You can do that until theres only one plate left.
Upvotes: 0
Reputation: 17564
They do opposite things.
You push
to add it to the stack of visible UIViewController
s, and pop
it to remove it.
The terminology comes from the stack
data-structure. The idea is that you "push", or place, objects on the top of the stack, and each object can't be removed until all the objects above it have been removed ("popped").
You can read more about stacks here.
Upvotes: 5