Using UIDatePicker inline style in popover - avoiding keyboard

Viewed 411

I am using the new UIDatePicker 'inline' style in iOS14, and I want to show the picker inside a popover, like I did before in iOS13. I manage to do this fine, but the problem happens when you select the 'time' picker which brings up the keyboard, causing the date picker to get squished.

UIDatePicker with popover

UIDatePicker in popover with Time selected

I'm not sure how I can avoid this happening. I've tried:

  • scrolling the presenting view controller's tableview to the top, and added a contentInset
  • setting a height constraint for the UIDatePicker control
  • listening to keyboard notifications, which get triggered but not sure what to do with it

Is there anything else I can try to get it to work correctly? Would love some ideas on potential solutions.

0 Answers
Related