Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS UIDatePicker display without time

I would like to have a Date Picker with only one wheel, filled with days as on the Date and Time mode.

enter image description here

If I choose the Date mode, I have 3 wheels and I loose the name of the day. In fact I would like something like the date and time mode, but only with the date.

I could use a UIPickerView, but I would have to fill it by myself with a very big array of data, as I want to be able go back far in time. With the Date picker, it's filled automatically, which is cool.

Is there a solution ?

like image 418
Eric Avatar asked Oct 19 '22 23:10

Eric


2 Answers

You can also use UIDatePicker's pickerMode property to do that.

datePicker.pickerMode = .Date

Look into header file, you will see that there are few other Options that you can play with. Other values are;

 Time
 Date
 DateAndTime
 CountDownTimer
like image 74
Sandeep Avatar answered Nov 15 '22 04:11

Sandeep


You should use the UIPickerView instead of the UIDatePicker. There is no possibility to customise UIDatePicker in the way you want.

like image 20
kirander Avatar answered Nov 15 '22 02:11

kirander