且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何查找/删除UITableViewCell的CUSTOM行详细信息

更新时间:2023-11-18 19:45:34

Update the data model according to edit actions delete using bellow code.

This bellow code is just an example for hot to delete or remove the object from array and also from table .. for more info check the tutorial which i post the link bellow..

- (void)tableView:(UITableView *)aTableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {

     if (editingStyle == UITableViewCellEditingStyleDelete) {

         [arryData removeObjectAtIndex:indexPath.row];

        [tblSimpleTable reloadData];

     } 
}

or also using this bellow logic with custom button of cell...

- (IBAction)deleteCustomCellWithUIButton:(id)sender
{
  NSIndexPath *indexPath = [yourTableView indexPathForCell:(UITableViewCell *)[[[sender superview] superview] superview]];
  NSUInteger row = [indexPath row];
  [yourTableView removeObjectAtIndex:row];
  [yourTableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]  withRowAnimation:UITableViewRowAnimationFade];
}

For more info refer these tutorial...

  1. iphone-sdk-tutorial-add-delete-reorder-UITableView-row

  2. multiple-row-selection-and-editing-in