我已經用我的應用程序的鏈接如何隱藏在警報視圖的關閉按鈕和關閉動作,只顯示「打開應用」按鈕
Adding Local Notifications With iOS 4
我的要求是實現UIlocalNotification
方法
在通知提醒我們需要只有"Show me"
按鈕,它默認打開應用程序,
我們需要強制用戶打開應用程序時,通知,所以一定沒有關閉butto n在通知警報中。
只有一個按鈕,也顯示我必須打開應用程序
怎麼樣?
我已經用我的應用程序的鏈接如何隱藏在警報視圖的關閉按鈕和關閉動作,只顯示「打開應用」按鈕
Adding Local Notifications With iOS 4
我的要求是實現UIlocalNotification
方法
在通知提醒我們需要只有"Show me"
按鈕,它默認打開應用程序,
我們需要強制用戶打開應用程序時,通知,所以一定沒有關閉butto n在通知警報中。
只有一個按鈕,也顯示我必須打開應用程序
怎麼樣?
如果您不想顯示警報操作按鈕,可以通過將hasAction
屬性設置爲NO
來禁用它。
請注意,如果沒有操作按鈕,則用戶無法從警報中啓動應用程序。
(如果你不希望看到的警報都應該設置alertBody
到nil
)
編輯:
UILocalNotification
的實現文件中定義爲 因此您可以不覆蓋它。確保您的視圖符合UIAlertViewDelegate協議:
@interface YourViewController : UIViewController <UIAlertViewDelegate>
當你想警報顯示,這樣做:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"Message" delegate:self cancelButtonTitle:@"Show me" otherButtonTitles:nil];
如果你想要做的事當按鈕點擊,執行此操作
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex;{
// the user clicked OK
if (buttonIndex == 0)
{
//do something here...
}
}
他正在談論本地通知,而不是UIAlertView – LombaX 2013-03-12 07:16:00
您可以不要取消取消按鈕。
一些事情是否有:
showme
功能)。UIAlertView
。
即使這是可能的,我懷疑這會在App Store上被接受。一個不可忽略的通知,強迫用戶進入應用程序?它也會很快被我的手機拒絕。 – jrturton 2013-03-12 07:21:21