I am trying to set the UIDatePicker to come up with the time only. The DatePicker comes up through an action when the textfield is pressed. I have not used the DatePicker Viewer. Any help is appreciated. Thanks
let starttimedatePicker = UIDatePicker()
startTimeDiveTextField.inputView = starttimedatePicker
starttimedatePicker.addTarget(self, action: "startTimeDiveChanged:", forControlEvents: .ValueChanged)
func startTimeDiveChanged(sender: UIDatePicker) {
let formatter = NSDateFormatter()
formatter.timeStyle = .ShortStyle
startTimeDiveTextField.text = formatter.stringFromDate(sender.date)
}
Try setting its Mode:
This may help you.
If you are using DatePicker in Storyboard or Xib then set like this.