Saturday, June 8, 2013

UITableView tableView didEndEditingRowAtIndexPath example in Objective C (iOS).


UITableView tableView didEndEditingRowAtIndexPath

Tells the delegate that the table view has left editing mode.

- (void)tableView:(UITableView *)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath

Parameters
tableView
The table-view object providing this information.
indexPath
An index path locating the row in tableView.

Discussion of [UITableView tableView didEndEditingRowAtIndexPath]
This method is called when the table view exits editing mode after having been put into the mode by the user swiping across the row identified by indexPath. As a result, a Delete button appears in the row; however, in this "€œswipe to delete"€ mode the table view does not display any insertion, deletion, and reordering controls. When entering this "€œswipe to delete"€ editing mode, the table view sends a tableView:willBeginEditingRowAtIndexPath: message to the delegate to allow it to adjust its user interface.
UITableView tableView didEndEditingRowAtIndexPath example.
-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"canEditRowAtIndexPath");
    return YES;
}

-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"commitEditingStyle");
}

-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"editingStyleForRowAtIndexPath");
    return UITableViewCellEditingStyleDelete;
}

- (void)tableView:(UITableView *)tv didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"didEndEditingRowAtIndexPath");
}

Example of [UITableView tableView didEndEditingRowAtIndexPath].
- (void)tableView:(UITableView *)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@\"Got into didEndEditingRowAtIndexPath\");
}

UITableView tableView didEndEditingRowAtIndexPath example.
- (void) tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath {
    onlyEditingOneRow = YES;
}
- (void) tableView:(UITableView *)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath {
    onlyEditingOneRow = NO;
}

End of UITableView tableView didEndEditingRowAtIndexPath example article.