Change UIDatePicker Order?

假装没事ソ 提交于 2019-12-07 07:25:44

问题


Seeing from this url, date picker is shown as month-date-year, can i change it to date-month-year?


回答1:


This is determined by the locale setting of the device it's running on, as per the Developer Page (look at the DatePicker mode sections).

The exact items shown and their order depend upon the locale set.

The property 'locale' can be used to explicitly specify a mode to use, but this is deprecated as of iOS 5. It's generally best to leave this setting alone, so that the date will display in the format most familiar to users for the region they have their phone set to.




回答2:


Set DatePicker local as "en_GB", you will get date-month-year order.

datePicker.datePickerMode = UIDatePickerMode.date

datePicker.locale = NSLocale(localeIdentifier: "en_GB") as Locale



来源:https://stackoverflow.com/questions/12345208/change-uidatepicker-order

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!