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)
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…