UIDatePicker in UIDatePickerModeCountDownTimer mod

2019-05-07 21:15发布

问题:

I added UIDatePicker in my storyboard, and set mode to CountDownTimer. It shows hours and minutes only, but what i need is minutes and seconds mode. I don't need hour column, need minute and seconds columns. I try to change interval, but it's minimum value is 1 minute. Is it possible? How can I do this?

回答1:

You can create a datasource for you minute-seconds picker. It has two Components: minute and seconds. You have to implement some methods in UIPickerViewDelegate and UIPickerViewDataSource Protocols.

Apple's sample code UICatalog.app is for your reference. You can find there is a sample for how to create a customized picker.