IOS5中的本地通知 - 如何使其在屏幕上弹出而不是在通知中心弹出?
我有一个使用本地通知的应用程序。 现在,当 IOS5 退出并且显示通知警报时,它会转到通知中心,然后用 2 个按钮(显示和取消)向我显示警报。
有人可以帮我弄清楚吗,这样我就可以让它在屏幕上弹出,而不是在通知中心(屏幕顶部的线)中。
这是我的代码:
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate=[NSDate date];
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.alertBody = @"Application alerted";
localNotif.alertAction = @"Show";
localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.applicationIconBadgeNumber = 0;
[[UIApplication sharedApplication]presentLocalNotificationNow:localNotif];
[localNotif release];
谢谢, 阿米尔。
i have an application that use the Local notification.
now when the IOS5 is out and the notification alert is show - it goes to the notification center and now showing me the alert with my 2 buttons (show and cancel).
can someone please help me figure it, so i can make it pop up in the screen and not in the notification center (the line in the top of the screen).
this is my code:
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate=[NSDate date];
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.alertBody = @"Application alerted";
localNotif.alertAction = @"Show";
localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.applicationIconBadgeNumber = 0;
[[UIApplication sharedApplication]presentLocalNotificationNow:localNotif];
[localNotif release];
Thanks,
Amir.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只有用户自己可以配置通知警报的呈现方式。用户还可以禁用应用程序的通知或禁止它们进入通知中心。没有为此提供的开发人员 API。
Only the user itself can configure how notification alerts will be presented. Users can also disable notifications for an app or ban them from notification center. There is no developer API for that.
您的意思是
UIAlertView
吗?您可以使用 -(id)initWithTitle
创建一个AlertView
...您可以配置按钮,如果您的类是UIAlertViewDelegate
那么您可以监听按钮点击等。它将弹出屏幕并允许用户关闭它或执行其他操作。Do you mean
UIAlertView
? you can create anAlertView
with -(id)initWithTitle
... You can configure the buttons and if your class is aUIAlertViewDelegate
then you can listen out for button clicks, etc. It will popover the screen and allow the user to dismiss it or some other action.