-3

在我的应用程序中,我在表格视图中显示本地通知。

这是代码:

NSArray *notificationArray=[[UIApplication sharedApplication] scheduledLocalNotifications];
UILocalNotification *notif = [notificationArray objectAtIndex:indexPath.row];
[cell.textLabel setText:notif.alertBody];
[cell.detailTextLabel setText:[notif.fireDate description]];

我想从表格视图中删除选定的行,我该怎么办?

4

2 回答 2

0

如果要删除行...从模型中删除。

[yourModelArray removeObjectAtIndex:indexPath.row];

编辑:

重新加载表格视图:

[tableView reloadData];
于 2013-01-08T17:21:13.007 回答
0

如果您询问如何删除特定的本地通知,当用户点击特定单元格时:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSArray *notificationArray=[[UIApplication sharedApplication] scheduledLocalNotifications];
    UILocalNotification *notificationToCancel= [notificationArray objectAtIndex:indexPath.row];

    [[UIApplication sharedApplication] cancelLocalNotification:notificationToCancel];
    [yourTable reloadData];
}
于 2013-01-08T17:29:24.600 回答