UIDatePicker sets minute to 1 when image 0 is selected

I use the same instance of UIDatePicker to set three different values. Two of them are dates, and the last is time (for example, 1:05).

My problem is related to using UIDatePicker when installing in UIDatePickerModeCountDownTimer mode. First, doc says that when set in this mode, the date property is ignored, and countDownDuration should be used to retrieve the value. In my case, after setting the collector to this mode, date not ignored , but countDownDuration is (= null)!
EDIT: the property is set correctly, I just registered it incorrectly (the %@ modifier was used instead of %f ); my next question remains though.

The worst part is that the date is set correctly, but unfortunately not when I select 0:00. During this time, the date is set to 0:01!

Any help? What am I missing?

+4
source share
2 answers

The countdown timer is for setting the countdown time. So, zero just doesn't make sense. Obviously, the minimum value is limited to 1 minute.

There is one strange behavior: if you set the interval for the timer to more than 1 minute, you can choose 0, but get 1 inside your code. When the interval is 1 minute, you will notice that you cannot select 0 minutes in the collector; he leans back. I believe that the previous behavior is a mistake. You can never choose 0 minutes, no matter how long the interval.

+1
source

use UIDatePickerModeTime instead of the countdown to select 00, but it will certainly look a little different than the countdown, look:

 _datePicker.datePickerMode = UIDatePickerModeTime; _datePicker.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"NL"]; 
0
source

Source: https://habr.com/ru/post/1338103/


All Articles