XCode: Displaying a UIDatePicker when user clicks on UITextbox

前端 未结 4 1429
一个人的身影
一个人的身影 2020-12-29 00:32

I have already researched this topic to death and found people posting the exact same question on a number of websites including right here in stackoverflow.

I have

4条回答
  •  悲&欢浪女
    2020-12-29 01:19

    It is very easy. Defines delegate TextField (UITextFieldDelegate) in the .h in the viewDidLoad .m

    myTextField.setDelegate = self;
    

    In the same viewDidLoad associates the datePicker to myTextField.

    myTextField.inputView = myDatePicker;
    

    You can also do anime, but this is the easiest way.

提交回复
热议问题