質問

I want to customise a UIDatePicker. The user will be asked to select a

  • year (1984-2100) and
  • quarter (Q1-Q4).

An exact input of the date (with options day/month/year) is unfortunately not an option. An acceptable compromise would be only showing options for month and year.

  • As far as I have researched, it is not possible to customise Apple's UIDatePicker in that way. Am I right?
  • Which other options would I have to solve that problem?
  • Are there any 3rd party options that solve this specific issue?

I am aware of the UIPickerView, but I hoped I could avoid hacking two pickers together.

役に立ちましたか?

解決

Maybe this could help? It of course is built on top of UIPickerView, as there really is no way of modifying the UIDatePicker to hide days.

https://github.com/rolandleth/LTHMonthYearPickerView

You also could customize it very easily by changing the month numbering and names in the LTHMonthYearPickerView.m file.

他のヒント

You are correct, you can't use UIDatePicker. Use a UIPickerView with two components, one for the year and one for the quarter.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top