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.
Set datePickerMode to UIDatePickerModeTime .
datePickerMode
UIDatePickerModeTime
Please try the following:
datePicker.datePickerMode = UIDatePickerModeTime;
Other options:
typedef enum { UIDatePickerModeTime, UIDatePickerModeDate, UIDatePickerModeDateAndTime, UIDatePickerModeCountDownTimer } UIDatePickerMode;
It will do the job
using the attribute inspector in the GUI, you can also set it as follows
In addition to the correct answers, to install it programmatically, you can also install it on your xib file in the attribute inspector tab.
Change UIDatePickerMode from UIDatePickerModeDateAndTime to UIDatePickerModeTime, like this ...
[self.datePicker setDatePickerMode:UIDatePickerModeTime];