NSLocalNotification - 当应用程序在 iOS5 中运行时显示通知动画
当应用程序运行且位于最前面的位置时,是否可以显示 NSLocalNotification
?正如Apple文档
所说,当应用程序位于最前面的位置时,不会显示通知(虽然它显示在通知中心,只是顶部没有翻转动画),那么有什么意义对于方法 presentLocalNotificationNow
: ?
Is it possible to show NSLocalNotification
when the app is running and in the foremost position? As the Apple document
says when the app is in the foremost position the notification will not be shown (it shows in notification center though, just doesn't have the flipping animation on top), then what's the point for method presentLocalNotificationNow
: ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您的应用程序处于活动状态时,您必须使用自己的 UI 来显示通知。使用 UIApplicationDelegate 的 application:didReceiveLocalNotification: 方法来查找何时发布通知。
You have to use your own UI to present notifications when your app is active. Use UIApplicationDelegate's application:didReceiveLocalNotification: method to find out when a notification is posted.
通知设计为当应用程序不再活动时触发。默认情况下,如果您的应用程序处于活动状态,它们就会被抑制。因此,如果您告诉它立即触发,它不会,因为它不会显示任何通知。对于在应用程序处于活动状态时立即发生的事情,您可以使用警报。我不相信您能够覆盖此默认行为。
Notifications are designed to be triggered when the app is no longer active. And by default, they are suppresed if your app is active. So if you tell it to trigger Now, it won't because it won't display any notifications. For something immediate while your app is active, you would use alerts. I don't believe you will be able to override this default behavior.