Is it possible to push a View Controller with a completion block?

ios, pushviewcontroller, uinavigationcontroller, uiviewcontroller

Solution

I would go with @justMartin's answer . But below is another approach.

push animation take 0.3 seconds.So, if you want to run some function here after completion use performSelector after 0.3 seconds of delay.

[self performSelector:@selector(completedPushing:) withObject:nil afterDelay:.3];

OR After pushing the `new viewController` onto `navigation stack`,the `old viewController view` is removed from view hierarchy.so this results in call of `viewDidDisappear` on old ViewController.You can write your `completion` code there. don't forget to call `super` at some point of implementation of viewDidDisappear.

Problem

UINavigationController's documentation contains no `pushViewController` methods with a `completion:` parameter.

Original source