I have pushed a view controller using
[self.navigationController pushViewController:myVC animated:YES];
now I am inside myVC and myVC is about to pop itself using
[self.navigationController popViewControllerAnimated:YES];
This will generate an asynchronous animation that will move the controller out of sight. Is there a way to run a method exactly when the animation finishes but before myVC being deallocated? I need the view and its objects to still be accessible and valid.
thanks.
I believe it’s good practice to ‘pop’ the view controller from within the same class as you ‘push’ it – partially for this reason. If the parent view controller is handling the push and pop, it can handle the retention and deallocation appropriately, and handle the animations.
However, either way, I’m thinking you want to make sure you ‘retain’ the object until the animation is complete, which, upon a selector callback, you would release it (and handle your additional code).