Wrong UINavigationControllerDelegate’s behavior with the back gesture

Originator:marco
Number:rdar://21137690 Date Originated:28-May-2015 09:24 AM
Status:Open Resolved:
Product:iOS SDK Product Version:
Classification:UI/Usability Reproducible:Always
 
Summary:
I find UINavigationControllerDelegate’s behavior with the back gesture just wrong.
-willShowViewController: gets called only once for the previous view controller. After that no indication whether user canceled the gesture. Neither -willShowViewController: or -didShowViewController: get called when the user cancels the back gesture, making it impossible to know what happened of that action and what’s the final state of UINavigationController

Steps to Reproduce:
Implement 
- navigationController:willShowViewController:animated:
– navigationController:didShowViewController:animated:
and start dragging the view to begin a back gesture. You’ll notice that -willShowViewController: will get called one for the previous controller. Cancel the back gesture. No callback. It’s impossible to know what’s the state of UINavigationController now.

Expected Results:
Both -navigationController:willShowViewController:animated: and -navigationController:didShowViewController:animated: should be called if the user cancels the back gesture.

Actual Results:
No delegate callback is performed.

Notes:
https://twitter.com/marcosero/status/603830762920669184

Comments

Problem is that -navigationController:didShowViewController:animated: has already been called for you current view controller, when you are using interactive pop willShow will be called for the controller you are heading to, but it isn't ever "shown" (didShow) so if you cancel it does't make sense to call didShow on the one that never disappeared from the screen.

That's logical.

I wonder why you might want to know the state of your navigation outside of an interactive transition anyway, not that in an interactive transition you do know if it was completed/cancelled.

By phillips1988 at May 28, 2015, 2:08 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!