【发布时间】:2019-09-11 08:00:37
【问题描述】:
我有一个tableview,当我点击删除它从tableview中删除但我还需要从firebase实时数据库中删除我该怎么做?
-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSString *uuid = self.firebaseUidArray[indexPath.row];
[[[self.taskRef child:@"tasks"] child:uuid] removeValueWithCompletionBlock:^(NSError * _Nullable error, FIRDatabaseReference * _Nonnull ref) {
[self.tasks removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
[[NSNotificationCenter defaultCenter] postNotificationName:@"UpdateTableViewForDeleting" object:nil];
}];
}
【问题讨论】:
标签: ios objective-c uitableview firebase-realtime-database