-presentViewController:animated:completion:
and -pushViewController:animated:
mean different things. The former says "present this other view controller so as to replace yourself". The latter says "show this other view controller within yourself, as part of the list you're controlling".
So it's about who is considered to be in charge of the display after the transition. In the former case the navigation controller surrenders control. In the latter it retains control.
The former functionality is provided by UIViewController
. The latter is specific to UINavigationController
.
Because the two actions are quite different, the opposite actions are separate. Navigation controllers could catch dismissViewController:...
and check how the named controller was presented, branching either into the superclass or into pop...
but the conflation of tasks would be unappealing from a design and a maintenance point of view.
Since the navigation controller doesn't promise to map the one thing to the other, and UIViewController
doesn't promise any particular behaviour if the controller you pass hasn't previously been presented, I think the literal answer to your question is: the consequence of mixing these two things up is undefined behaviour.