2012-01-12 13 views
0

NSArrayというオブジェクトが追加されたテーブルがlistOfConjProceduresという名前になっていますテーブルの一番上の行の上に表示される挿入コントロールを使用して、UInavigationコントローラの編集ボタンをタップするときにテーブルに行を追加します私は良いサンプルコードを見つけることができません。 編集機能は、次のようになります。テーブルに行を追加する

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 
    if ([tableView isEditing]) 
     return [listOfConjProcedures count] + 1; 
    else 
     return [listOfConjProcedures count];  
} 

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    if (editingStyle == UITableViewCellEditingStyleDelete) { 
     // Delete the row from the data source. 
     [listOfConjProcedures removeObjectAtIndex:indexPath.row]; 
     [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; 
    } else if (editingStyle == UITableViewCellEditingStyleInsert) { 
     // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view. 

      }    
     } 

私は編集ボタンが(掲示コードの下部に)タップしたときに新しい行を導入するために、インサート機能を続行する方法がわかりません。 ありがとうございます。

答えて

1

このリンクを挿入新しい行のためにあなたを助けますlink1link2link3

関連する問題