选择视图0时,UIDatePicker设置为1 [英] UIDatePicker setting minute to 1 when on the view 0 is selected

查看:111
本文介绍了选择视图0时,UIDatePicker设置为1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用相同的 UIDatePicker 实例来设置三个不同的值。其中两个是日期,最后一个是时间(例如1:05)。

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).

我的问题是关于使用 UIDatePicker 当设置在模式 UIDatePickerModeCountDownTimer 时。首先, doc说设置在此模式下, date 属性将被忽略,并且必须使用 countDownDuration 来获取该值。在我的情况下,将选择器设置为此模式后,日期不会被忽略,但 countDownDuration 是(= null)!
编辑:属性设置正确,我根本没有正确记录它(%@ 修饰符是使用而不是%f );我的下一个问题仍然存在。

My issue is regarding the use of the UIDatePicker when set in mode UIDatePickerModeCountDownTimer. First the doc says that when set in this mode, the date property is ignored and the countDownDuration must be used to fetch the value. In my case after setting the picker to this mode the date is not ignored but the countDownDuration is (=null)!
the property is correctly set, I simply not correctly logged it (%@ modifier was used instead of %f); my next issue remains though.

最糟糕的是,日期设置正确,但不幸的是,当我选择0:00。此时,日期设置为0:01!

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

任何帮助?我缺少什么?

Any help? What am I missing?

推荐答案

倒计时器用于设置倒计时的时间。所以,零没有任何意义。显然,最小值被限制为1分钟。

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.

虽然有一个奇怪的行为:如果将定时器的间隔设置为超过1分钟,您可以选择0,但在你的代码中得到1。当间隔为1分钟时,您会注意到您不能在选择器中选择0分钟;它反弹。我认为以前的行为是一个错误。您不应该选择0分钟,无论间隔时间有多大。

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时,UIDatePicker设置为1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆