在我的应用中,我在表格视图中显示本地通知。
以下是代码:
NSArray *notificationArray=[[UIApplication sharedApplication] scheduledLocalNotifications];
UILocalNotification *notif = [notificationArray objectAtIndex:indexPath.row];
[cell.textLabel setText:notif.alertBody];
[cell.detailTextLabel setText:[notif.fireDate description]];
我想从表格视图中删除所选行,我该怎么办?
答案 0 :(得分:0)
如果要删除行...从模型中删除。
[yourModelArray removeObjectAtIndex:indexPath.row];
编辑:
重新加载您的表格视图:
[tableView reloadData];
答案 1 :(得分: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];
}