2011-01-05 26 views
5

私は見たところ、私と同じ問題を抱えていたスタックオーバーフローがどこにあるのか分からないようです。だから私は、次のコードを使用しスワイプで削除する

-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    if (editingStyle == UITableViewCellEditingStyleDelete); 
} 

を、私は削除ボタンが表示されますが、押されたとき、それは何もしないスワイプするとき、私は何を忘れていますか?

答えて

10

ifステートメントの後で実際にデータを削除する必要があります。現在のところ、ifステートメントは、何もしません。なぜなら、ステートメントの後ろにセミコロンが付いているからです。

-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    if (editingStyle == UITableViewCellEditingStyleDelete) 
    { 
     //Code to delete data goes here. 
     //This could include removing an object from an array, deleting it from core data, 
     //and removing the selected row. 
    } 
} 
+0

歓迎しています。魅力的です。 –

+0

嬉しいです。すべてが機能している場合は、「受け入れ」とマークすることを忘れないでください。 :) – GendoIkari

+1

あなたは知っている、私はこれを働いた可能性がありますが、それよりも頻繁に、ここで最初に見て非常に簡単に迅速です。偉大な、簡単な答え、それは素晴らしく動作します。 – PKCLsoft

関連する問題