是否可以在 iphone 应用程序在屏幕上时弹出本地通知? [英] Is it possible to pop up local notifications while the iphone app is on screen?
问题描述
我需要在应用程序处于活动状态时弹出 iphone 应用程序的本地通知.这可能吗?如果是这样怎么办?
I need a local notification for an iphone app to pop up while the app is active. Is this possible? If so how?
推荐答案
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
在您安排了通知并且应用程序已经在运行时调用..它是一个 UIApplication
委托方法..
is called if you have a notification scheduled and the app is already running..it is a UIApplication
delegate method..
在这里您可以执行自定义代码..通过访问通知...
here you can do your custom code..by accessing the notification...
如果您想立即显示通知..那么您可以将通知触发日期设置为过去...它将被触发...然后您可以在上面给定的 UIapplication 方法中创建一个警报视图
if you want to present a notification right now .. then you can just set the notification fire date to past...it will be fired..then you can create a alert view in the above given UIapplication method
这篇关于是否可以在 iphone 应用程序在屏幕上时弹出本地通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!