I’m attempting to dismiss a datePicker throughout collection of date by addTarget operate. After once I choose 12 months it dismiss earlier than I choose date and once I choose the date first I can’t choose 12 months. what I truly need is, throughout collection of 12 months it should not dismiss. It ought to dismiss once I choose date. Is there any potential answer for this with utilizing UIdatePicker ?
That is my code
let datePicker : UIDatePicker = {
let date = UIDatePicker()
date.datePickerMode = .date
date.preferredDatePickerStyle = .compact
date.tintColor = UIColor(purple: 83/255, inexperienced: 176/255, blue: 184/255, alpha: 1)
return date
}()
func config() {
datePicker.addTarget(self, motion: #selector(selectButtonAction), for: .primaryActionTriggered)
}
@objc func selectButtonAction() {
// code logic ...
dismiss(animated: true)
}