问题描述
我在iphone日期选择器中面临本地化问题。我希望日期选择器仅以英语显示日期,但现在它需要在iphone设置中设置为该区域的语言。我尝试了各种没用的东西如下所示。
I facing a problem with localization in iphone date picker.I want the date picker to show dates only in English, but now it takes the language which is set to the region in iphone settings.I tried various things which was not useful like the below.
- 在uidatepicker的nib文件中设置区域设置。
-
通过代码设置语言环境
- setting the locale setting in the nib file of the uidatepicker.
setting the locale through code
NSLocale* locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_GB"];
[datePicker setLocale:locale];
[datePicker setCalendar:[locale objectForKey:NSLocaleCalendar]];
这不起作用。如果有人有解决问题的好主意请帮忙
This did not work.If any one has good ideas to resolve the issue please help
推荐答案
我认为这是一个已知问题。日期选择器似乎依赖于当前用户的国家/地区设置,您无法从代码中进行更改。实际上,我不知道locale属性是什么。它什么都不做。
I think this is a known issue. The date picker seems to rely on the current user's country settings which you cannot change from code. In fact, I don't know what the locale property is there for. It simply does nothing.
这篇关于iphone uidatepicker本地化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!