在CoreData中存储DateTime

时间:2018-01-23 20:48:35

标签: ios swift datetime core-data

@IBOutlet weak var Datetime: UITextField!

let datePicker = UIDatePicker()

func createDatePicker()

{

    let toolbar = UIToolbar()
    toolbar.sizeToFit()
    let doneButton = UIBarButtonItem(barButtonSystemItem: .done, target:nil,action: #selector(donePressed))

    toolbar.setItems([doneButton], animated: false)

    Datetime.inputAccessoryView = toolbar
    Datetime.inputView = datePicker

}
newEvent.setValue(formater.stringFromDate(Datetime), forKey: "eventDateTime")
嘿伙计们,我通过日期选择器在文本字段中获取日期和时间。我可以将其提交给核心数据

0 个答案:

没有答案