1

I want to have a hidden datepicker and trigger a tap event on that UIControl when I tap another UIView.

@objc func editDateTime() {
    self.datePicker.sendActions(for: .touchUpInside)
}

Whether datepicker is hidden or not, I am not seeing date picker opening up. Basically I am trying to show a custom UI instead of the standard rendering of date picker.

2
  • 2
    Unroftunatelly, this is not possible Commented Mar 6, 2021 at 8:57
  • Have you tried .becomeFirstResponder()? Commented Mar 6, 2021 at 11:02

1 Answer 1

2

I'm guessing you want the "popup calendar" feature?

If so, you can overlay a button (or label, or view, or whatever) on the Compact Date Picker, and allow a tap to pass-through to the trigger the calendar popup.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. Just that with iOS 13 or 14 there are new formats and behave differently (inline, compact, etc.) Need the overlay to cover what is applicable. May be cumbersome but will be a good workaround.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.