在倒数计时器模式下更改 UIDatePicker 的语言环境
Changing locale of UIDatePicker in Countdown Timer mode
我在 CountdownTimer
模式下有 UIDatePicker
,需要将 hours
和 min
的措辞更改为德语语言环境。我都试过了,在故事板和代码中将 locale
设置为 German (Germany)
,但都失败了,应用程序仍然显示 hours
和 min
.[=21 的默认英文单词=]
timePicker.locale = Locale(identifier: "de")
当我在 UIDatePicker
上以 Date and Time
模式配置语言环境时,它正确地遵循德语语言环境并以德语格式显示日期。知道为什么区域设置在倒数计时器模式下没有改变吗?谢谢。
感谢 Why UIActivityViewController doesn't display localized cancel string? post 该解决方案还解决了在倒数计时器模式下本地化 UIDatePicker
的问题,至少在 iOS 11。谢谢。
将此行添加到您的 info.plist
:
而且它还有助于正确定位系统共享 sheet 的 Cancel
按钮:UIActivityViewController - how to change the cancel button text。
我在这里提到来自 APPLE 的回复,我在这个特定问题上得到了技术支持,但不幸的是还没有对此功能的支持。
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;
问题是他们没有提到支持此功能的任何时间表。
我在 CountdownTimer
模式下有 UIDatePicker
,需要将 hours
和 min
的措辞更改为德语语言环境。我都试过了,在故事板和代码中将 locale
设置为 German (Germany)
,但都失败了,应用程序仍然显示 hours
和 min
.[=21 的默认英文单词=]
timePicker.locale = Locale(identifier: "de")
当我在 UIDatePicker
上以 Date and Time
模式配置语言环境时,它正确地遵循德语语言环境并以德语格式显示日期。知道为什么区域设置在倒数计时器模式下没有改变吗?谢谢。
感谢 Why UIActivityViewController doesn't display localized cancel string? post 该解决方案还解决了在倒数计时器模式下本地化 UIDatePicker
的问题,至少在 iOS 11。谢谢。
将此行添加到您的 info.plist
:
而且它还有助于正确定位系统共享 sheet 的 Cancel
按钮:UIActivityViewController - how to change the cancel button text。
我在这里提到来自 APPLE 的回复,我在这个特定问题上得到了技术支持,但不幸的是还没有对此功能的支持。
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;
问题是他们没有提到支持此功能的任何时间表。