ios - What is the best practice to add validation code on a Back button action in a UIViewController? -
i have uiviewcontroller created via instantiateviewcontrollerwithidentifier. in controller, user may enter text need validate before saving. there button user clicks , trigger save. if there error, not allow user go back. best practice this? read stackoverflow , solution seems overriding uinavigationcontroller, think sort of hack. cannot put code in willmovetoparentviewcontroller since there no return of true or false. still proceed.
you can use extension.
this answer seems solve problem.
Comments
Post a Comment