iosswiftuidatepicker

UIDatePicker UIDatePickerStyle = .compact notification when pop-up calendar is dismissed


I would like to receive a notification when the user dismisses the pop-up calendar for a .compact style UIDatePicker. The user may trigger several valueChanged while trying to select the right date, so I would like to get notified when the user taps outside the calendar to dismiss it.


Solution

  • You can try to observe editingDidEnd control event:

    yourDatePicker.addTarget(self, action: #selector(yourCallback), for: .editingDidEnd)