Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iphone uidatepicker localization

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

like image 519
SGA Avatar asked Nov 06 '22 01:11

SGA


1 Answers

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.

like image 165
hennes Avatar answered Nov 12 '22 15:11

hennes