title: Why is there empty space between my UIDatePicker and its toolbar when using the new datepickerstyle?
body: <p>My iOS app uses a lot of UIDatePickers as input views for UITextFields. Before iOS 14, they worked perfectly and didn't have any issues. With the new &quot;compact&quot; style, though, for some reason there is a bar of transparent space in between the datepicker and its toolbar. This only happens on the iPhone X and later, so I'm assuming it's something to do with the curved screen, but I don't see what part of the code is causing the issue. Below are a code snippet of the datepicker as well as a screenshot of the issue— any help would be appreciated.</p>
  <pre><code>            let toolbar = UIToolbar()
              toolbar.sizeToFit()
              let finishedButton = UIBarButtonItem(title: &quot;Done&quot;, style: .plain, target: self, action: #selector(donedatePicker))
              finishedButton.tag = datePickerField!.tag
              let spaceButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.flexibleSpace, target: nil, action: nil)
              let cancelButton = UIBarButtonItem(title: &quot;Cancel&quot;, style: .plain, target: self, action: #selector(cancelDatePicker))
              cancelButton.tag = datePickerField!.tag
              
              toolbar.setItems([cancelButton,spaceButton,finishedButton], animated: false)
              datePickerField!.inputAccessoryView = toolbar //datePickerField is the UITextField
  </code></pre>
  <p>The gray background and the &quot;save changes&quot; button are the actual app itself.</p>
  <p><a href="https://i.stack.imgur.com/ybAx3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ybAx3.png" alt="enter image description here" /></a></p>