iOS - Dismiss UIDatePicker presented as inputView

前端 未结 4 927

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

4条回答
  •  醉酒成梦
    2021-01-18 05:29

    I've done a similar thing where I've created a view with a button and the UIDatePicker, then presented that view instead of the UIDatePicker alone. Then the button is just connected to an IBAction that moves the view out.

    This way, the button moves in with the UIDatePicker view and they look "connected" to the user. You can even define this UIView in your nib and use addSubview: at runtime.

提交回复
热议问题