How can I show a UIDatePicker instead of a keyboard when a user selects a UITextField?

后端 未结 4 1972
忘了有多久
忘了有多久 2021-02-14 14:32

I have a nice clean UI within a table view which has a few text fields for the user to fill out. One of the fields is for the user\'s birthday.

I\'d like to have it so t

4条回答
  •  爱一瞬间的悲伤
    2021-02-14 15:21

    Why are you using a text field if you don't want to accept user input from a keyboard? Instead use a UILabel subclass (where you override the touchesBegan/Ended:withEvent: set of methods to show the UIDatePicker) or a UIButton (where your action is a method which slides up the UIDatePicker).

提交回复
热议问题