如何在iOS中本地化UIDatePicker中的月份文本,如果可能的话? [英] How in iOS to localize text of the month in UIDatePicker, and if it is possible at all?

查看:97
本文介绍了如何在iOS中本地化UIDatePicker中的月份文本,如果可能的话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我进行搜索,到目前为止我看到UIDatePicker正在使用设备的本地化。

I make search and up to now I see that UIDatePicker is working with localization of the device.

我有app内部lozalization。我需要根据我的内部本地化改变月份的文本。在我看来,这似乎是不可能的 - 我必须自己制作自己的选择器。

I have app which has internal lozalization. I need to change month's text dependantly of my internal localization. As I read it appears that this is not possible - I have to make my own custom picker.

有没有办法在没有自定义数据选择器的情况下实现呢?

Is there a way to achieve that without custom Dat picker?

推荐答案

使用UIDatePicker的locale属性。我看不到任何有关该物业被弃用的迹象。

Use locale property of UIDatePicker. I can't see any signs that the property is deprecated.

此代码将选择器本地化为日语。

This code will localize picker to Japanese.

[datePicker setLocale: [NSLocale localeWithLocaleIdentifier:@"ja"]];

将ja替换为您需要的任何语言代码。

Replace "ja" with any language code you need.

这篇关于如何在iOS中本地化UIDatePicker中的月份文本,如果可能的话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆