简体   繁体   中英

UIDatePicker changing NSLocale Issue

Hope every body is doing great.

I just came across a strange issue, changing manually NSLocale of UIDatepicker is not working but in only specific mode

datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(10, 130, [UIScreen mainScreen].bounds.size.width-20, 120)];  

NSLocale* locale = [NSLocale localeWithLocaleIdentifier:[AppDelegate getLocale]];  

[datePicker setLocale:locale];  

datePicker.datePickerMode = UIDatePickerModeCountDownTimer;  

Now here it only returns hours and Minutes in English irrespective of Locale value, While if you set

datePicker.datePickerMode = UIDatePickerModeDate;  

Or even this

datePicker.datePickerMode = UIDatePickerModeTime;  

Is working fine

Only when you use

datePicker.datePickerMode = UIDatePickerModeCountDownTimer;

locale is not working in that case,

Is it a bug in UIDatepicker that needs to be fixed, or what is work around?

Well i got an Email/Answer from APPle that is not possible for now, may be in future.

Thanks for contacting to Apple's Developer Technical Support.

When running in the count down mode, UIDatePicker showns the hours and minutes to count down. In this context, the “hours” and “minutes” are not a format, thus not covered by locale; rather, they are labels describing the meaning of the numbers, which honor to the application language. Note that locale is quite different from language. See WWDC 2014 Session 201 "Advanced Topics in Internationalization” for the details.

so we have to wait for that till Apple fix that :( .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM