iphone uidatepicker localization

2019-04-09 04:09发布

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.

  1. setting the locale setting in the nib file of the uidatepicker.
  2. 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

1条回答
Rolldiameter
2楼-- · 2019-04-09 04:15

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.

查看更多
登录 后发表回答