At canEditRowAtIndexPath Method, reloadData of UITableView not work properly?

前端 未结 5 821
离开以前
离开以前 2021-01-05 23:05

In my application, I reload my TableView ([tablView reloadData];) after delete row from TableView then canEditRowAtIndexPath Method alway

5条回答
  •  梦谈多话
    2021-01-05 23:28

    - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
    {
    
        if (editingStyle == UITableViewCellEditingStyleDelete)
        {
            [self.sql_ deleteSoundFileAudioTableWhereMainID:[[self.listOfSounds objectAtIndex:indexPath.row] objectForKey:@"main_id"]]; /// delete record from DB
            [self.listOfSounds removeObjectAtIndex:indexPath.row]; /// delete record from Array
            [self updateListofSoundsFile]; /// Custom method
        }
       [self.tblView reloadData]; 
    }
    

提交回复
热议问题