如何使用三个按钮(如关闭,提醒和稍后提醒)添加本地通知警报。

关闭将关闭警报
提醒会打开应用程序,稍后提醒也会打开应用程序,我必须导航到应用程序中的其他选项卡。

我知道我们可以在具有类别的IOS 8中实现此功能,是否有任何方法可以在IOS 7中实现相同的功能?

提前致谢。

最佳答案

只需安排UILocalNotification并在触发它时弹出AlertView即可。这是AlertView的代码。这是基于您的最高要求

func openAlertView(消息:字符串!)
    {
        让topController = UIApplication.sharedApplication()。keyWindow!.rootViewController

    let alertController = UIAlertController(title: "Alert Title", message: message, preferredStyle: .Alert)

    let CloseAction = UIAlertAction(title: "Close", style: .Cancel) { (action) in
        // Close Alert
    }
    alertController.addAction(cancelAction)

    let RemindAction = UIAlertAction(title: "Remind", style: .Default) { (action) in

        //Schedule another notification at the preferred time
    }
    alertController.addAction(OKAction)

    topController!.presentViewController(alertController, animated: true) {
    }
let RemindLaterAction = UIAlertAction(title: "RemindLater", style: .Default) { (action) in

        //Schedule another notification at the preferred time
    }
    alertController.addAction(OKAction)

    topController!.presentViewController(alertController, animated: true) {
}

关于ios - 带选项的Swift IOS 7通知警报,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31965762/

10-12 00:16
查看更多