簡體   English   中英

IOS5中的本地通知 - 如何使其在屏幕上而不是在通知中心中彈出?

[英]local notification in IOS5 - how to make it pop on the screen and not in the notification center?

我有一個使用本地通知的應用程序。 現在,當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];

謝謝,阿米爾。

只有用戶自己才能配置通知警報的顯示方式。 用戶還可以禁用應用程序的通知或禁止通知中心。 沒有開發人員API。

你的意思是UIAlertView 您可以使用 - (id) initWithTitle創建AlertView ...您可以配置按鈕,如果您的類是UIAlertViewDelegate那么您可以聽取按鈕點擊等。它將彈出屏幕並允許用戶關閉它或其他一些行動。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM