Dates in UIDatepicker not displaying properly

断了今生、忘了曾经 提交于 2019-12-24 10:44:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!