Display datepicker on tapping on textfield

后端 未结 5 1632
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-27 14:43

How can I display a datetimepicker control on tap of a textbox?

I have a user interface that has arrival and departure text fields, and when a user clicks on arriva

5条回答
  •  抹茶落季
    2020-11-27 14:55

    Very simple, in ViewController.h put the UITextFieldDelegate after in viewDidLoad.

    txtFecha.delegate = self;
    
    datePicker = [[UIDatePicker alloc]init];
    [datePicker setDatePickerMode:UIDatePickerModeDate];
    
    self.txtFecha.inputView = datePicker;
    

提交回复
热议问题