How to disable only date picker in UIDatePicker, not time picker

I use UIDatePicker in my application and I want to disable only the date picker in it, and the time picker should not be performed.

Can anyone help me with this.

+4
source share
6 answers

Set datePickerMode to UIDatePickerModeTime .

+9
source

Please try the following:

 datePicker.datePickerMode = UIDatePickerModeTime; 

Other options:

 typedef enum { UIDatePickerModeTime, UIDatePickerModeDate, UIDatePickerModeDateAndTime, UIDatePickerModeCountDownTimer } UIDatePickerMode; 
+3
source

It will do the job

 datePicker.datePickerMode = UIDatePickerModeTime; 

using the attribute inspector in the GUI, you can also set it as follows enter image description here

+1
source

In addition to the correct answers, to install it programmatically, you can also install it on your xib file in the attribute inspector tab.

0
source

Change UIDatePickerMode from UIDatePickerModeDateAndTime to UIDatePickerModeTime, like this ...

 [self.datePicker setDatePickerMode:UIDatePickerModeTime]; 
0
source
 datePicker.datePickerMode = UIDatePickerModeTime; 
0
source

All Articles