local notification in IOS5 - how to make it pop on the screen and not in the notification center?
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.
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.
Do you mean UIAlertView
? you can create an AlertView
with -(id)initWithTitle
... You can configure the buttons and if your class is a UIAlertViewDelegate
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.
精彩评论