简体   繁体   English

NSLocalNotification - 在iOS5中运行应用程序时显示通知动画

[英]NSLocalNotification - show notification animation when the app is running in iOS5

Is it possible to show NSLocalNotification when the app is running and in the foremost position? 是否有可能在应用程序运行且显示最重要位置时显示NSLocalNotification 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 : ? 正如Apple document所说,当应用程序处于最重要位置时,通知将不会显示(它显示在通知中心,但没有顶部的翻转动画),那么方法presentLocalNotificationNow的重点是什么?

You have to use your own UI to present notifications when your app is active. 当您的应用处于活动状态时,您必须使用自己的UI来显示通知。 Use UIApplicationDelegate's application:didReceiveLocalNotification: method to find out when a notification is posted. 使用UIApplicationDelegate的应用程序:didReceiveLocalNotification:方法查找发布通知的时间。

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. 因此,如果您告诉它触发Now,则不会,因为它不会显示任何通知。 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. 我不相信你能够覆盖这种默认行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM