2017-08-21 9 views
0

私はテーブルビューを持っていますが、それらのすべてではなくUITableViewCellEditingStyleDeleteを表示したいと思います。条件に基づいて、一部のセルの場合、私はpopoverを削除ボタンのスタイルなしで表示したいと考えています。特定のセルでUITableViewCellEditingStyleDeleteを無効にする

私の現在の実装では、スワイプして削除すると、まだUITableViewCellEditingStyleDeletepopoverの両方を見ることができました。

UITableViewCellEditingStyleDeleteを使わずに右から左にスワイプすると、どのように達成できるのですか?popover

self.tableView.allowsMultipleSelectionDuringEditing = NO; 


-(void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    if([GlobalFunctions isComboItem:itemId]) 
    { 
     // Show popover --> done 
     // hide UITableViewCellEditingStyleDelete --> ?? dont know 
    } 
} 

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { 
    if (editingStyle == UITableViewCellEditingStyleDelete) { 
     NSString *itemId = [(NSDictionary *)[sharedData.orderItems objectAtIndex:indexPath.row] objectForKey:kItemId]; 
     [GlobalFunctions deleteItemFromOrder:itemId]; 
     [self calculate]; 
    } 
} 
+1

あなたの質問はAnbu.Karthik @ –

+0

明らかではないが、試してみてください、いくつかのtablecellsがあることを前提としています。ユーザーが右から左にスワイプすると、tableviewセルに削除ボタンが表示されます。しかし、いくつかのセルでは、削除ボタンを表示せずにポップオーバーだけを表示したい。 – hotspring

+0

いくつかの追加コードを追加することができます –

答えて

0
If (indexpath.row > 5) { 
// editing is not allowed greater than five 

} else { 
// 5,4,3,2,1 editing is allowed 
} 

この

関連する問題