8vius 8vius - 8 months ago 88
iOS Question

iOS - Dismiss UIDatePicker presented as inputView

I have a text field in my UI that when it's selected presents a UIDatePicker instead of the default keyboard, how could I set up a button as to dismiss the picker when the user is done?


What I do is have my inputView as a custom view which contains a UIDatePicker and a toolbar above it with a 'Done' button wired up to a method that calls a delegate method to tell the object that owns the UITextField to dismiss the "keyboard" by calling resignFirstResponder.