我现在拥有的日期选择器的样式如下:mm/dd/YYYY,它显示在“YYYY/MM/DD”的文本字段中。
如何更改我的代码,以便显示的日期选择器也更改为“YYYY/MM/DD”。这是我的代码:
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] ;
NSDate *currentDate = [NSDate date];
NSDateComponents *comps = [[NSDateComponents alloc] init] ;
[comps setYear:-10];
NSDate *maximumDate = [calendar dateByAddingComponents:comps toDate:currentDate options:0];
[comps setYear:-10];
NSDate *minimumDate = [calendar dateByAddingComponents:comps toDate:currentDate options:0];
UIDatePicker *datePicker = [[UIDatePicker alloc]init];
datePicker.datePickerMode = UIDatePickerModeDate;
[datePicker setMaximumDate:maximumDate];
[datePicker setMinimumDate:minimumDate];
[datePicker addTarget:self action:@selector(datePickerValueChanged:) forControlEvents:UIControlEventValueChanged];
[self.Birthday setInputView:datePicker] ;