PopToViewController deinit order

I have viewController stack about A -> B -> C. I called popToViewController from C to A.

I think that deinit process is C -> B but B -> C. Isn't stack??

I don't know why this process.....

Please answer me!!

Thank you

Answered by Frameworks Engineer in 702150022

There is no specific ordering to the deinit process because it is undefined as to if the UINavigationController has the last owning reference on your view controllers, and there is no guarantee that it will release the outgoing view controllers in any particular order.

In fact, if your doing an animated pop, it is most likely that B will deinit first (assuming no other owning reference), because UIKit only needs A & C for the transition. But even that is unpredictable as we do not force a deinit, we only release our owning reference.

Accepted Answer

There is no specific ordering to the deinit process because it is undefined as to if the UINavigationController has the last owning reference on your view controllers, and there is no guarantee that it will release the outgoing view controllers in any particular order.

In fact, if your doing an animated pop, it is most likely that B will deinit first (assuming no other owning reference), because UIKit only needs A & C for the transition. But even that is unpredictable as we do not force a deinit, we only release our owning reference.

PopToViewController deinit order
 
 
Q