在倒数计时器模式下更改UIDatePicker的语言环境 [英] Changing locale of UIDatePicker in Countdown Timer mode
问题描述
我在CountdownTimer
模式下具有UIDatePicker
,需要将hours
和min
的措辞更改为德语语言环境.我同时尝试了这两种方法,分别在情节提要和代码中将locale
设置为German (Germany)
,但是都失败了,该应用仍然显示hours
和min
的默认英语单词.
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")
当我在Date and Time
模式下在UIDatePicker
上配置语言环境时,它会正确遵守德语语言环境并以德语格式显示日期.知道为什么在倒数计时器模式下语言环境不会更改吗?谢谢.
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.
推荐答案
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.
将此行添加到您的info.plist
:
And it also helps to correctly localize Cancel
button of the system share sheet: UIActivityViewController - how to change the cancel button text.
这篇关于在倒数计时器模式下更改UIDatePicker的语言环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!