在自定义视图类中从Superview中关闭UIVIew函数

时间:2019-03-19 17:28:08

标签: ios swift xcode

我有一个自定义视图,其中有一个按钮。无论在何处创建视图,我都希望此按钮可以关闭视图。我希望这是有道理的。

@objc func dateSubmission(sender: CustomButton){
    sender.shake()
    let currentDate = Date()
    let interval = datepicked?.timeIntervalSince(currentDate)
    print(interval)
    let notifcation = UNMutableNotificationContent()
    notifcation.title = notificationTitle ?? "title empty"
    notifcation.subtitle = "test"
    notifcation.body = "test2"
    notifcation.badge = 1

    let trigger = UNTimeIntervalNotificationTrigger(timeInterval: interval!, repeats: false)
    let request = UNNotificationRequest(identifier: "taskReminder", content: notifcation, trigger: trigger)
    UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)

}

我尝试添加removefromsuperview(),但是它不起作用。

0 个答案:

没有答案