当iphone应用程序在屏幕上时,是否可以弹出本地通知? [英] Is it possible to pop up local notifications while the iphone app is on screen?

查看:118
本文介绍了当iphone应用程序在屏幕上时,是否可以弹出本地通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在应用处于活动状态时弹出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

如果您安排了通知且应用程序已在运行,则会调用

。 .it是 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆