UIDatePicker.Model.countDownTimer:我可以只显示五乘五的分钟吗



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

还是我需要为此编写自己的UIPickerView

感谢您的帮助

是的,您应该设置时间间隔:5。

间隔是以秒为单位测量的,因此它可以像标准一样执行时钟,我们应该将这个参数设置为1。如果你想用5秒来数数5。你应该把5作为一个参数。

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

最新更新