Actually using UIDatePickerModeCountDownTimer as a timer

天大地大妈咪最大 提交于 2019-12-06 14:12:39
vodkhang

Your code lacks a line, you have to set the mode for your UIDatePicker. The full code should be:

UIDatePicker *pickerView = [[UIDatePicker alloc] init];
pickerView.datePickerMode = UIDatePickerModeCountDownTimer;

// please DON'T use new because it is objc syntax
NSTimeInterval timeInterval = (NSTimeInterval)pickerView.countDownDuration;

and then if you don't know how to convert your NSTimeInterval (seconds) to minutes, you can use this question

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!