如何仅在iOS中使用DatePicker接受Month和Year [英] How to accept only Month and Year using DatePicker in iOS
本文介绍了如何仅在iOS中使用DatePicker接受Month和Year的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果不可能使用datepicker,那么请另行建议。
提前谢谢。 / p>
解决方案
Choice-1
strong> Objective-C
yourDatepicker.datePickerMode = UIDatePickerModeDate;
Swift
yourDatepicker.datePickerMode = UIDatePickerMode.Date
Swift3
yourDatepicker.datePickerMode = .date
另一种模式是
- UIDatePickerModeTime,
- UIDatePickerModeDateAndTime,
- UIDatePickerModeCountDownTimer
UIDatePickerModeDate
选择2
上述方法不能正常运行,然后检查链接
I am building an app using swift and in that app there is one field for accepting expiry date for Debit card for payment purpose. How can I accept only month and year by using DatePicker in Swift.
If it is not possible using datepicker then please suggest any another way.
Thank you in advance.
解决方案
Choice-1
Objective-C
yourDatepicker.datePickerMode = UIDatePickerModeDate;
Swift
yourDatepicker.datePickerMode = UIDatePickerMode.Date
Swift3
yourDatepicker.datePickerMode = .date
the another modes are
- UIDatePickerModeTime,
- UIDatePickerModeDate,
- UIDatePickerModeDateAndTime,
- UIDatePickerModeCountDownTimer
Choice-2
the above method not working well, then check this link
这篇关于如何仅在iOS中使用DatePicker接受Month和Year的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文