问题
I have UIDatePicker
in CountdownTimer
mode and need to change the wording of hours
and min
to German locale. I tried both, to set locale
to German (Germany)
in storyboard and in code, but both failed and the app still shows default english words for hours
and min
.
timePicker.locale = Locale(identifier: "de")
When I configure locale on UIDatePicker
in Date and Time
mode, it correctly respects German locale and displays the date in german format. Any idea why locale does not change in Countdown timer mode? Thank you.
回答1:
Thanks to Why UIActivityViewController doesn't display localized cancel string? post the solution also resolved the issue of localizing UIDatePicker
in countdown timer mode, at least on iOS 11. Thank you.
Add this row into your info.plist
:
And it also helps to correctly localize Cancel
button of the system share sheet: UIActivityViewController - how to change the cancel button text.
回答2:
I am mentioning here reply from APPLE that i got upon Technical support on this specific issue but unfortunately there is no support to this feature yet.
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;
Thing is that they did not mention any time line for support of this feature.
来源:https://stackoverflow.com/questions/48063778/changing-locale-of-uidatepicker-in-countdown-timer-mode