首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >带有选项的Swift IOS 7通知警报

带有选项的Swift IOS 7通知警报
EN

Stack Overflow用户
提问于 2015-08-12 12:50:41
回答 1查看 339关注 0票数 0

如何添加本地通知警报与三个按钮,如关闭,提醒和提醒后。

关闭将关闭,提醒将打开应用程序,提醒稍后也将打开应用程序,我必须导航到我的应用程序中的不同选项卡。

我知道我们可以在IOS 8中使用类别来实现这个功能,在IOS 7中有实现相同功能的方法吗?

提前谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-08-12 13:30:18

只需安排一个UILocalNotification,并有一个AlertView弹出时,它已经启动。这是AlertView的代码。这是基于您的最高要求。

func openAlertView(消息:String!){ let topController =openAlertView

代码语言:javascript
复制
    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) {
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31965762

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档