iOS - Change Language for UIDatePicker by locale

浪尽此生 提交于 2019-12-01 09:46:00

问题


I'm creating the app in "Herbrew" language. (Language of IPhone can be anything, but my app runs only in Herbrew). In iOS for UIDatePicker, we have a property "locale" which will change the language that it is displaying. But in iOS5, the property is deprecated. How can I achieve it now?


回答1:


Unfortunately, you cannot achieve this, not even with the calendar trick described by Martin Ulrich. I've struggled with the same problem myself and after a long research, I found out the bitter truth: the only way to change the localization of the UIDatePicker is to change the device's language.

If the user will have the app's language as Hebrew, everything will be alright. If not, there's nothing you can do, except maybe create your own date picker. Sorry




回答2:


You can set the calendar property of the UIDatePicker to [NSCalendar currentCalendar]



来源:https://stackoverflow.com/questions/9638698/ios-change-language-for-uidatepicker-by-locale

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!