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

查看:15
本文介绍了选择视图 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).

我的问题是关于在 UIDatePickerModeCountDownTimer 模式下设置时 UIDatePicker 的使用.首先 doc 说,当在此模式下设置,date 属性将被忽略,并且必须使用 countDownDuration 来获取值.在我的情况下,在将选择器设置为这种模式后,date 不会被忽略 ,但 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天全站免登陆