I have a simple UITextField called month where I get users to simply enter the month they want via the keyboard that comes up. I would now like it for them to be able to use a UIPickerDate (or UIPicker) to make this selection instead. So when they press on the text field, a mini UIPicker appears and they make there selection, press anywhere on the screen and the picker disappears.
Does anyone know how to do this or has any suggestions? I am pretty new to programming and have looked at other answers but everyone seems to be referring to this being done in a table.
Thanks in advance!
You can set the
inputViewproperty on theUITextFieldto be an instance ofUIDatePicker. When the instance ofUITextFieldbecomes the first responder, the picker view will be displayed with the standard keyboard animation.As for dismissing, that depends on the context. If there are more text fields to populate, consider adding a
UIToolbaras theinputAccessoryViewofself.monthTextField. Then you can add something like aUIBarButtonItemto make the next text field the first responder, similar to how the standard keyboard provides a Next button.