stephanie
stephanie

Reputation: 21

How to add a doubleClick action to a datePicker

How can I set a doubleClick event in an NSDatePicker and make doubleClick change its selected date the same as click does?

let doubleClick = NSClickGestureRecognizer(target: self, action: #selector(doubleClickEvent))
doubleClick.numberOfClicksRequired = 2
uploadDatePicker.addGestureRecognizer(doubleClick)  

I add this ClickGestureRecognizer for my DatePicker. When I double clicked in the DatePicker, it can correctly get into the function doubleClickEvent but the selected date didn't change.

How should I code to make the DatePicker change its selected date when user double click any date?

Upvotes: 2

Views: 212

Answers (0)

Related Questions