2012-01-17 7 views
0

editControlationButtonを表示するようにしようとしています(編集モード中)。編集コントロールをクリックしたときと同じように動作しますが、私の場合はクリックしますUITableCellを介して。クリックしたUITableViewCellでdeleteConfirmationButtonを表示するには

私はすでにプロパティーAllowsSelectionDuringEditingをYESに設定していますが、行を削除することができます。私はdeleteConfirmationButtonを使用して、事故を避ける必要があります。

どのようにすればいいですか?

ありがとうございます!

答えて

0

これを行うには、編集中にオブジェクトが選択または削除されたときに呼び出されるcommitEditingStyleForRowAtIndexPath関数を使用します。確認のため

- (BOOL)tableView:(UITableView *)tableView 
canEditRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
return YES; 
}  

そして、このような何か:私が探していたが、私はそれが問題を解決すべきだと思うものではありませんです

- (void)tableView:(UITableView *)tableView 
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle 
forRowAtIndexPath:(NSIndexPath *)indexPath 

{ 
//make a UIAlert and display confirmation, if yes then run the following code, if no then break 

// remove the object 
[myItems removeObjectAtIndex:indexPath.row]; 

// refresh the table view to display your new data 
[tableView reloadData]; 
} 
+0

を。 – jMelnik

関連する問題