bendodson/MonthYearWheelPicker

How to implement?

Closed this issue · 1 comments

Hi, i have download your file and copy in to my project.
But somehow I not manage to implement it.
let ChooseYear: UITapGestureRecognizer = UITapGestureRecognizer(target: self ,action: #selector(self.ChooseYearr)) self.yearLabel.addGestureRecognizer(ChooseYear) yearLabel.isUserInteractionEnabled = true

func ChooseYearr(){ let expiryDatePicker = MonthYearPickerView() expiryDatePicker.onDateSelected = { (month: Int, year: Int) in let string = String(format: "%02d/%d", month, year) NSLog(string) // should show something like 05/2015 } }

Why?

You'll need to actually attach the MonthYearPickerView to something be that adding it as a subview to your UIView or by using it as an input with a keyboard. This is basically a drop-in replacement for UIPickerView() so whatever you would do to present a picker is what you should do to present this.