我希望我的用戶通知在用戶使用datePicker操作選擇通知顯示的日期和時間時顯示。使用DatePicker安排通知(swift3)
import UIKit
import UserNotifications
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func datePicker(_ sender: Any) {
}
@IBAction func disaper(_ sender: Any) {
let c = UNMutableNotificationContent()
c.title = "Lets Roll"
c.subtitle = "dx"
c.body = "fyb"
let t = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)
let r = UNNotificationRequest(identifier: "any", content: c, trigger: t)
UNUserNotificationCenter.current().add(r, withCompletionHandler: nil)
}}
好的,你想使用日期選擇器。進一步解釋你發佈的代碼與你陳述的目標有何關係。 –
當datePicker從其初始日期發生更改時,我希望計劃通知,只要它是未來而不是過去的日期和時間。 –
好的,你有什麼嘗試?您發佈的代碼應該做什麼,它不符合您的需求? –