I want to ask that how can I set the iOS Count Down Timer's maximum time? (eg. 1 hour and 30 minutes at most)
Count Down Timer is get from UIDatePicker
's mode:
Thanks!
EDIT:
Someone said I have to set the minimum/maximum date, and I just set them in the storyboard but I don't see any difference:
(the time of the setting is my local time +- 30 minutes)
EDIT:
From Apple:
The minimum and maximum dates are also ignored in the countdown-timer mode (UIDatePickerModeCountDownTimer).
So is their anyway to do this?
In your case for UIDatePickerModeCountDownTimer you can handle it programmatically
Add an event called when the value of your
UIDatePicker
has changed.Objective-C
Swift
Then if the value selected is out of allowed selection, you can set the DatePicker to maximum allowed valued (or whichever you want)
Objective-C
Swift
-- Previous answer :
I leave previous answer for others using a
UIDatePicker
in Date or DateAndTime mode, if that can help some peopleYou can set minimum and maximum date of your
UIDatePicker
.Here user can't select a time before present time, and just go ahead 1 hour and 30 minutes.
Any attempt to select another time will make the
UIDatePicker
to automatically go back to an allowed time interval.