Created
December 4, 2017 02:30
-
-
Save thanhtungka91/c8426446e1d189a87834d596352c75c6 to your computer and use it in GitHub Desktop.
delete cell int able view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//from view did load add edit | |
- (void)viewDidLoad | |
{ | |
self.memberView.allowsMultipleSelectionDuringEditing = NO; | |
[super viewDidLoad]; | |
[resultView setHidden:YES]; | |
} | |
// enable | |
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { | |
// Return YES if you want the specified item to be editable. | |
return YES; | |
} | |
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { | |
if (editingStyle == UITableViewCellEditingStyleDelete) { | |
Members *member = [self.members objectAtIndex:indexPath.row]; | |
NSLog(@"%@",member.customer_id); | |
// get customer_id and then update to api | |
// remove from datasource | |
[memberdat removeObjectAtIndex:indexPath.row]; | |
// remove from table view | |
// [memberView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationMiddle]; | |
// [memberView endUpdates]; | |
rowcount = rowcount - 1; | |
// dififrent betwen understnad and cpy | |
[memberView reloadData]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment