Hi Friends, I am trying to delete a row from a UITableView. My UITableView is populated from a NSMutableArray named TableData. When i am deleting a row and reloaded the tableview, it shows that the last row has been removed [not the selected row]. But when i NSLog the contents of mutable array it shows that the selected row has been removed.
This is my code
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
[TableData removeObjectAtIndex:indexPath.row];
[tableView reloadData];
for (int i=0; i<[TableData count]; i++)
{
NSLog(@"Value at %d :%@",i,[TableData objectAtIndex:indexPath.row]);
}
}
}
[SORRY FOR MY POOR ENGLISH]