Modes
suggest changeUIDatePicker has various picker modes.
enum UIDatePickerMode : Int {
case Time
case Date
case DateAndTime
case CountDownTimer
}
Time- The date picker displays hours, minutes, and (optionally) an AM/PM designation.Date- The date picker displays months, days of the month, and years.DateAndTime- The date picker displays dates (as unified day of the week, month, and day of the month values) plus hours, minutes, and (optionally) an AM/PM designation.CountDownTimer- The date picker displays hour and minute values, for example [ 1 | 53 ]. The application must set a timer to fire at the proper interval and set the date picker as the seconds tick down.
Set datePickerMode:
let datePicker = UIDatePicker(frame: CGRect(x: 0, y: 0, width: 320, height: 200))
datePicker.datePickerMode = .Date
The capitalized case names are Swift 2. On iOS 14 and later the default picker style is no longer the wheel, so a 200-point frame does not by itself show that wheel.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents