title: UIDatePicker components not scrolling properly and sometimes moves outside of the view
body: <p>UIDatePicker components not scrolling properly and sometimes moves outside of the view.</p>
  
  <p>Tried with adding date picker programatically as well as using storyboards.</p>
  
  <p>I am assigning date picker as textField's input view. And textField is in table view cell. 
  <strong>Code</strong> </p>
  
  <pre><code>func assignDatePickerTo(textField: UITextField) { 
      let datePicker = UIDatePicker() 
      datePicker.datePickerMode = UIDatePickerMode.date 
      let currentDate = Date() 
      datePicker.minimumDate = currentDate      
      datePicker.setDate(currentDate, animated: false) 
      datePicker.backgroundColor = UIColor.white     
       datePicker.addTarget(self, action: #selector(self.neededFromDateChanged(sender:)), for: UIControlEvents.valueChanged) 
  
      textField.inputView = datePicker 
  }
  </code></pre>
  
  <p><strong>UI Screenshot below</strong></p>
  
  <p><a href="https://i.stack.imgur.com/Qr5wV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qr5wV.png" alt="enter image description here"></a></p>