我需要更改代码,以便我们只在UIDatePicker中显示时间。
func textFieldDidBeginEditing(textField: UITextField) {
if textField == TextfieldDataSelection {
let datePicker = UIDatePicker ()
textField.inputView = datePicker
datePicker.addTarget(self, action: "datePickerChanged:", forControlEvents: .ValueChanged)
}
if textField == TextfieldDeadline {
let datePicker = UIDatePicker ()
textField.inputView = datePicker
datePicker.addTarget(self, action: "date1PickerChanged:", forControlEvents: .ValueChanged)
}
}
func datePickerChanged(sender:UIDatePicker) {
let formatter = NSDateFormatter()
formatter.dateStyle = .MediumStyle
TextfieldDataSelection.text = formatter.stringFromDate(sender.date)
}
func date1PickerChanged(sender:UIDatePicker) {
let formatter = NSDateFormatter()
formatter.dateFormat = "MMM dd, yyyy hh:mm a"
TextfieldDeadline.text = formatter.stringFromDate(sender.date)
答案 0 :(得分:1)
您需要将datePickerMode
的{{1}}属性设置为UIDatePicker
Time
答案 1 :(得分:0)
设置
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
pras.add(new JobName("your job name", Locale.getDefault()));
docPrintJob.print(docToPrint, pras);