我在contentView中有一个带UIDatePicker的UITableViewCell。我已经将nib中的minuteInterval设置为30,我也是以编程方式编写的。但是,当第一次显示tableview单元格时,日期选择器不尊重我的minuteInterval!下次显示时,它已自行更正。我尝试过setNeedsDisplay,但这似乎不起作用......
如何强制UIDatePicker刷新'本身?
这是我的代码:
DDDatePickerTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:DatePickerCellIdentifier
forIndexPath:indexPath];
if ([self.expandedIndexPath isEqual:self.startTimeIndexPath]) {
cell.datePicker.date = self.selectedStartDate;
cell.datePicker.minimumDate = self.minDate;
cell.datePicker.maximumDate = self.selectedEndDate;
} else if ([self.expandedIndexPath isEqual:self.endTimeIndexPath]) {
cell.datePicker.date = self.selectedEndDate;
cell.datePicker.minimumDate = self.selectedStartDate;
cell.datePicker.maximumDate = self.maxDate;
}
cell.datePicker.calendar = self.calendar;
cell.datePicker.minuteInterval = 30.f;
cell.datePicker.datePickerMode = UIDatePickerModeTime;
答案 0 :(得分:1)
似乎必须在datePickerMode
minuteInterval