Skip to content

Instantly share code, notes, and snippets.

@thanhtungka91
Created December 4, 2017 02:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thanhtungka91/c8426446e1d189a87834d596352c75c6 to your computer and use it in GitHub Desktop.
Save thanhtungka91/c8426446e1d189a87834d596352c75c6 to your computer and use it in GitHub Desktop.
delete cell int able view
//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