UIDatePicker 15 Minute Increments Swift -
in swift
, i'm wondering how use uidatepicker
select 15 minute increments. instead of having hours 60 minutes, want able select 00 minutes, 15 minutes, 30 minutes, , 45 minutes.
here current implementation
var schedulepicker: uidatepicker = uidatepicker() schedulepicker.datepickermode = uidatepickermode.dateandtime schedulepicker.addtarget(self, action: "handleschedulepicker:", forcontrolevents: uicontrolevents.valuechanged) textfield9.inputview = schedulepicker .... func handleschedulepicker(sender: uidatepicker) { var dateformatter = nsdateformatter() dateformatter.dateformat = "mmm/dd/yy hh:mm a" textfield9.text = "\(dateformatter.stringfromdate(sender.date))" }
set shedulepicker.minuteinterval = 15
i found answer here: https://developer.apple.com/library/ios/documentation/uikit/reference/uidatepicker_class/#//apple_ref/occ/instp/uidatepicker/minuteinterval
it's take @ documentation :)
Comments
Post a Comment