- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
[amountSpend removeObjectAtIndex:indexPath.row];
NSLog(@"after Delete-- %@",amountSpend);
NSArray *path1 = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory1 = [path1 objectAtIndex:indexPath.row];
NSString *fullFileName1 = [NSString stringWithFormat:@"%@amountSpend", documentsDirectory1];
[amountSpend writeToFile:fullFileName1 atomically:NO];
[tableView reloadData];
// 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
}
}
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
[amountSpend removeObjectAtIndex:indexPath.row];
NSLog(@"after Delete-- %@",amountSpend);
NSArray *path1 = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory1 = [path1 objectAtIndex:indexPath.row];
NSString *fullFileName1 = [NSString stringWithFormat:@"%@amountSpend", documentsDirectory1];
[amountSpend writeToFile:fullFileName1 atomically:NO];
[tableView reloadData];
// 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