问题
I have UIDatepicker .I have few queries to ask
1.)When i tap on UIButton the dates in datepicker gets retuns to minimum value since i have given maximum and minimum value . In doing that function the date in datepicker appears to be in non highlighted manner ![enter image description here. The link mentioned below shows how the date appears in datepicker
http://postimg.org/image/7mlxiq6sz/
-
(IBAction)notificationButtonChanged:(UIButton *)control
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if (control.tag == 1)
{
self.selectedButton = control.tag;
NSDate *date1 = [defaults objectForKey:@"morningTimeKey"];
if(!date1) date1 = [NSDate date];
components = [gregorian components: NSUIntegerMax fromDate:date1];
[components setHour:12];;
[components setMinute:00];
NSDate *startDate = [gregorian dateFromComponents:components];
[components setHour:14];
[components setMinute:00];
NSDate *endDate = [gregorian dateFromComponents:components];
[userTimePicker setDatePickerMode:UIDatePickerModeTime];
[userTimePicker setMinimumDate:startDate];
[userTimePicker setMaximumDate:endDate];
[userTimePicker setDate:date1 animated:YES];
[userTimePicker reloadInputViews];
}
}
来源:https://stackoverflow.com/questions/16819007/dates-in-uidatepicker-not-displaying-properly