如何设置UIDatePickerView的时间间隔?

时间:2016-08-07 14:00:44

标签: ios objective-c uidatepicker

我设置call activate py34 jupyter notebook 的时间间隔为30分钟并准确到达。但我怀疑的是,当我为UIDatePickerView设置minimumDateUIDatePickerView[NSDate date],其中当前时间是04:25。然后minimumDate设置为04:00。但是我想要04:30。 我的代码是

 datePicker.datePickerMode = UIDatePickerModeDateAndTime;
 datePicker.minuteInterval = 30;
datePicker.minimumDate = [NSDate date];
datePicker.maximumDate = [[NSDate date]dateByAddingTimeInterval:32*60*60];

1 个答案:

答案 0 :(得分:1)

试试这个:

datePicker.datePickerMode = UIDatePickerModeDateAndTime;
datePicker.minuteInterval = 30;
datePicker.minimumDate = [[NSDate date] dateByAddingTimeInterval:30*60];
datePicker.maximumDate = [[NSDate date] dateByAddingTimeInterval:(32*60*60 + 30*60)];