繁体   English   中英

UIDatePicker.Mode.countDownTimer:我可以只显示五乘五分钟吗?

[英]UIDatePicker.Mode.countDownTimer: can I display minutes only five by five?

是否可以将UIDatePicker.datePickerMode =.countDownTimer使用,但将分钟设置为五乘五? 我的意思是,只有0, 5, 10, 15...作为分钟的可能值?

或者我需要为此编写自己的UIPickerView吗?

谢谢您的帮助

是的,您应该设置 timeInterval:5。

间隔以秒为单位,因此要让它像标准时钟一样运行,我们应该将此参数设置为 1。如果您想以 5 秒为单位计算 5。 您应将 5 作为参数传递给。

func runTimer() { 
     timer = Timer.scheduledTimer(timeInterval: 5, target: self,   selector: (#selector(TimeViewController.updateTime)), userInfo: nil, repeats: true)
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM