CopyPastor

Detecting plagiarism made easy.

Score: 1.6771655678749084; Reported for: String similarity, Exact paragraph match Open both answers

Possible Plagiarism

Plagiarized on 2015-04-21
by Sanjay Mohnani

Original Post

Original - Posted on 2014-08-09
by rmaddy



            
Present in both answers; Present only in the new answer; Present only in the old answer;

For deleting cell you should use
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { return UITableViewCellEditingStyleDelete; }
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { NSUserDefaults *usd = [NSUserDefaults standardUserDefaults]; [usd removeObjectForKey:@"payViaCreditCard"]; selectedCardID = nil; [[CreditCardManager sharedCreditCardManager] removeCreditCard:creditCardToDelete]; [self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; //[self.tableView reloadData]; } }
If you don't want to allow deleting, just reordering, then there is no need to do anything about indenting. Instead, just do:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { return UITableViewCellEditingStyleNone; }
And don't implement the `tableView:commitEditingStyle:forRowAtIndexPath:` method at all.
You also avoid returning `deleteAction` from `tableView:editActionsForRowAtIndexPath:`.
That will prevent row deletion. You can now support reordering as needed.

        
Present in both answers; Present only in the new answer; Present only in the old answer;