ios – DatePicker包含Year

前端之家收集整理的这篇文章主要介绍了ios – DatePicker包含Year前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在我的应用程序中实现了dataPicker.但它只显示月,日,小时.我怎么能在日期选择器中添加年份.任何的想法?

解决方法

datePicker.datePickerMode = UIDatePickerModeDate;

UIDatePickerModeDate

The date picker displays months,days of the month,and years. The exact order of these items depends on the locale setting. An example
of this mode is [ November | 15 | 2007 ].

06001

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIDatePicker_Class/Reference/UIDatePicker.html

您也可以从故事板设置模式更改:(参见屏幕截图)

猜你在找的iOS相关文章