문제

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