0
我使用的是UIDatePicker
在Count Down Timer
模式供用户输入出行时间: 的setdate在倒计时器模式下的UIDatePicker
,我可以返回的时间以秒这样的:
@IBAction func customTimeSelected(_ sender: Any) {
print("user selected custom time: \(customeTimePicker.countDownDuration)")
}
但是如何以秒为单位设置UIDatePicker
?
继承人我尝试:
let travelDate = Date(timeIntervalSinceNow: TimeInterval(5400)) // hour and a half in seconds
self.customeTimePicker.setDate(travelDate, animated: false)
然而,这会返回一个不正确的时间: