UIDatePicker setting minute to 1 when on the view 0 is selected

前端 未结 2 1614
死守一世寂寞
死守一世寂寞 2021-01-13 15:53

I\'m using the same UIDatePicker instance to set three different values. Two of them are dates and the last is a time (e.g. 1:05).

My issue is regarding

相关标签:
2条回答
  • 2021-01-13 16:25

    The count-down timer is intended for setting a time for count-down. So, zero simply makes no sense. Obviously the minimum value is constrained to 1 minute.

    There is one strange behavior though: if you set the interval for the timer to more than 1 minute, you are able to select 0, but get 1 inside your code. When the interval is 1 minute, you notice that you cannot select 0 minutes in the picker; it snaps back. I consider the former behavior a bug. You should never be able to select 0 minutes, no matter how big the interval is.

    0 讨论(0)
  • 2021-01-13 16:27

    use UIDatePickerModeTime instead of count-down instead to select 00, but surely it will look some different from count-down, have a look:

    _datePicker.datePickerMode = UIDatePickerModeTime;
    _datePicker.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"NL"];
    
    0 讨论(0)
提交回复
热议问题