暂停本地通知
我正在开发一个警报应用程序,并为此使用本地通知。现在我想为我的闹钟添加贪睡功能。我在Google上搜索发现iPhone不支持此类功能。
但还有其他方法可以做到这一点吗?
I am working on an alarm application and I am using local notification for that. Now I want to add snooze functionality to my alarm. I searched on Google and found that iPhone doesn't support such functionality.
But is there another way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,当通知窗口弹出时,您无法添加自定义行为。
但...
你可以这样尝试:
用户单击“查看”并且应用程序由 UILocalNotification 启动后,
您可以使用一个巨大的“暂停”按钮和另一个(较小的)按钮“打开”打开一个模态视图。
如果用户点击“暂停”,您只需安排另一个本地通知并关闭应用程序。
那又怎样呢?
PS:几天前,我第一次使用这些本地通知。
我必须设计一个可以通用的类。
实现贪睡的方法会很酷!
如果我有更好的解决方案,我会再写信给你。
但请在这个论坛上告诉我(和其他人),如果您找到了好的解决方案。
AFAIK you can't add a custom behaviour when the notification windows pops up.
BUT...
You can try it like this:
after the user has clicked "View" and the app is launched by an UILocalNotification,
you could open a modal view with a huge button "Snooze" and another (smaller) one "Open".
And if the user taps "Snooze" you just schedule another local notification and close the app.
What about that?
PS: A couple of days ago I've worked the first time with these local notifications.
I had to design a class which can be used universally.
A method for implementing snooze would be cool!
I'll write you again, if I get a better solution.
But please tell me (and other) in this forum, If you have found a good solution.
阅读本文:
我认为您可以为您的警报应用程序使用本地通知...
Read This articles:
I think you can user Local Notifications for your alarm application ...