如何添加本地通知警报与三个按钮,如关闭,提醒和提醒后。
关闭将关闭,提醒将打开应用程序,提醒稍后也将打开应用程序,我必须导航到我的应用程序中的不同选项卡。
我知道我们可以在IOS 8中使用类别来实现这个功能,在IOS 7中有实现相同功能的方法吗?
提前谢谢。
发布于 2015-08-12 13:30:18
只需安排一个UILocalNotification,并有一个AlertView弹出时,它已经启动。这是AlertView的代码。这是基于您的最高要求。
func openAlertView(消息:String!){ let topController =openAlertView
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) {
}https://stackoverflow.com/questions/31965762
复制相似问题