1

これは私を夢中にさせるつもりです !同様の質問がたくさんありますが、このスワイプして削除する私のコードが機能しない理由をまだ理解できないようです! 「削除」ボタンが表示されません。デバイスと比較して、シミュレーターで UITableview セルをスワイプする特別な方法はありますか? これがコードです。

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath

{

return YES;
}


-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleDelete;
}



-(void) setEditing:(BOOL)editing animated:(BOOL)animated
{
  [super setEditing:editing animated:animated];

[self.tableView setEditing:editing animated:animated];
}




// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
   if (editingStyle == UITableViewCellEditingStyleDelete) 
{
    [attachmentsArray removeObjectAtIndex:indexPath.row];
    [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]     withRowAnimation:UITableViewRowAnimationLeft];
    [tableView reloadData];
}   

}

update - にブレーク ポイントを配置しましcanEditRowAtIndexPath,editingStyleForRowAtIndexPath, commitEditingStyleたが、コントロールは決して commitEditingStyle に移動しません。最初の 2 つの間でループし続けます。

4

0 に答える 0