Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customising Date Picker in Xcode

How can I customize a UIDatePicker to only show the month and year? There's an existing mode that shows the day, month, and year, but I'd like to get rid of the day portion.

like image 783
priya Avatar asked Nov 26 '25 15:11

priya


1 Answers

Simply put, you can't. UIDatePicker does not have any API for only showing years and months.

You therefore have 3 possible recourses:

  1. Make your own out of a UIPickerView
  2. Use a UIDatePicker in Date mode and just ignore the day portion
  3. File a bug asking for this capability and hope it gets added at some point

I vote for #1 and #3.

like image 154
Dave DeLong Avatar answered Nov 29 '25 07:11

Dave DeLong



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!