我正在制作提醒应用程序,其中有表格视图,单元格中有日期,当该单元格日期变为今天 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
}
现在我还实现了从表格视图中删除单元格的功能现在我的问题是单元格被删除但它的通知不是没有单元格但是当那个日期到来时通知就会触发。
删除该单元格后,我应该如何删除该特定通知?