我提醒應用程序有表格視圖,並且單元格中有日期,並且該單元格日期成爲今天的日期UILocalNotification會觸發。對於我使用下面的代碼刪除包含日期的單元格時的UILocalNotification
-(void)notification {
// logic for local notification start
NSDateFormatter *Form = [[NSDateFormatter alloc] init];
[Form setDateFormat:@"dd/MM/yyyy"];
UILocalNotification *notification = [[UILocalNotification alloc] init];
for (int i=0;i<_convertedBdates.count;i++)
{
NSDate *date =[Form dateFromString:[_convertedBdates objectAtIndex:i ]];
// NSLog(@"date%@",date);
if(notification)
{
notification.fireDate = date;
notification.timeZone = [NSTimeZone defaultTimeZone];
notification.alertBody = [NSString stringWithFormat:@"Today is %@\'s Birthday",[_combinedNameArray objectAtIndex:i]];
notification.alertAction = @"View";
notification.soundName = UILocalNotificationDefaultSoundName;
notification.applicationIconBadgeNumber = 1;
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
}
}
// local notification logic ends here
}
現在我還實施了從表視圖 刪除細胞的功能,現在我的問題是細胞被刪除,但其通知亦不存在任何細胞,但是當這個日期來再通知消防。
當該單元格被刪除時,我應該如何刪除該特定通知?
就可以證明這一點,請用一些例子嗎? – 2013-04-09 07:44:26
什麼部分不清楚? – drewmm 2013-04-09 14:04:57
它只是2個月我已經開始iPhone所以除了cancellocalnotification一切都不清楚即時通訊 – 2013-04-10 04:43:12