我将 UIDatePicker 设为时间选择器,并将其时间设置为 15:00。在某些地区,例如美国,它会在方向盘上正确显示为 03:00,但不是“PM”,而是显示“AM”。关于如何正确设置的任何想法?
当前代码:
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *comps = [gregorian components:(NSHourCalendarUnit | NSMinuteCalendarUnit) fromDate:_dateWithTime];
comps.hour = 15;
comps.minute = 0;
UIDatePicker *datePicker = [[UIDatePicker alloc] init];
datePicker.datePickerMode = UIDatePickerModeTime;
datePicker.minuteInterval = 15;
datePicker.timeZone = [NSTimeZone localTimeZone];
datePicker.minimumDate = [gregorian dateFromComponents:comps];
[datePicker addTarget:self action:@selector(checkinDatePickerChanged:) forControlEvents:UIControlEventValueChanged];