Saturday, 10 March 2012

TableView Editing and Deleting code and Delegate

- (void)viewDidLoad
{
    [super viewDidLoad];
self.navigationItem.rightBarButtonItem = self.editButtonItem;
}


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

if (editingStyle == UITableViewCellEditingStyleDelete) {

 // Delete the row from the data source
       [tableView deleteRowsAtIndexPaths:[amountSpend indexOfObject:indexPath.row] withRowAnimation:UITableViewRowAnimationFade];
    }  
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }  
}

No comments:

Post a Comment