iOS: How to Stay at Current View When Criteria Invalid, even Done Button is Pressed

55 views Asked by At

I have one view controller embedded in with navigation controller, implemented some simple feature with Picker View.

I also have one bar button which uses unwind segue connected to Exit. When user presses that "Done" button, it will go back to the first view controller, this works well.

My problem is, if user doesn't pick anything from picker view, and once "Done" button is pressed, it goes back to the first view controller. I won't hope this happen. view controller My expectation is: if user doesn't pick anything from picker view, although user still presses "Done" button, it shall stay at current view controller.

Does anyone know how to realise it? Thanks!!

1

There are 1 answers

1
Yaser On BEST ANSWER

Check this out: Inhibit Storyboard Segue from performing segue action

Or, perhaps better, you could disable the "done" button if it should not be accessible to the user. It has a simple property (enabled) to set which will help you.