在倒数计时器模式下更改UIDatePicker的语言环境 [英] Changing locale of UIDatePicker in Countdown Timer mode

查看:116
本文介绍了在倒数计时器模式下更改UIDatePicker的语言环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在CountdownTimer模式下具有UIDatePicker,需要将hoursmin的措辞更改为德语语言环境.我同时尝试了这两种方法,分别在情节提要和代码中将locale设置为German (Germany),但是都失败了,该应用仍然显示hoursmin的默认英语单词.

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:

它还有助于正确定位系统共享表的Cancel按钮:

And it also helps to correctly localize Cancel button of the system share sheet: UIActivityViewController - how to change the cancel button text.

这篇关于在倒数计时器模式下更改UIDatePicker的语言环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆