How to hide days in UIDatePicker and add Done button in the UIDatePicker.

There is no way to do it using UIDatePicker, you've to use the custom library or your own created custom view.
Use this Library MonthYearPickerView-Swift:
Add MonthYearPickerView.swift file to your project and use:
let monthYearPickerView = MonthYearPickerView()
monthlyPickerView.onDateSelected = { (month: Int, year: Int) in
let string = String(format: "%02d/%d", month, year)
NSLog(string) // should show something like 05/2015
}
monthYearPickerView.frame = CGRect(frame)
view.addSubview(monthYearPickerView)
Note: Add your own toolbar on top of PickerView.
Output:

Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With