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