1

I have a UIViewController that is created via instantiateViewControllerWithIdentifier. In that controller, the user may enter some text that I need to validate before saving. There is a back button that the user clicks and that will trigger the save. But if there is an error, I will not allow the user to go back. What is the best practice for this? I read stackoverflow and the solution seems to be overriding UINavigationController, which I think is some sort of hack. I cannot put the code in willMovetoParentViewController since there is no return of true or false. It will still proceed.

dickyj
  • 1,830
  • 1
  • 24
  • 41

1 Answers1

0

You can just use an extension.

This answer seems to solve your problem.

Community
  • 1
  • 1
guidev
  • 2,695
  • 2
  • 23
  • 44