UIDatePicker locale does nothing?

前端 未结 2 939
难免孤独
难免孤独 2021-01-21 02:25

I\'m creating a UIDatePicker programmatically, and setting its locale with the following code:

datePicker.locale = [[[NSLocale alloc] initWithLocaleIdentifier:@\         


        
2条回答
  •  野性不改
    2021-01-21 02:54

    Try changing the locale of the UIDatePicker's calendar as well:

    NSLocale *locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"es_ES"] autorelease];
    datePicker.locale = locale; 
    datePicker.calendar = [locale objectForKey:NSLocaleCalendar]; 
    

提交回复
热议问题