UITableView tableView willBeginEditingRowAtIndexPath
- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath
Parameters of [UITableView tableView willBeginEditingRowAtIndexPath]
tableView
The table-view object providing this information.
indexPath
An index path locating the row in tableView.
Discussion of [UITableView tableView willBeginEditingRowAtIndexPath]
This method is called when the user swipes horizontally across a row; as a consequence, the table view sets its editing property to YES (thereby entering editing mode) and displays a Delete button in the row identified by indexPath. In this "swipe to delete" mode the table view does not display any insertion, deletion, and reordering controls. This method gives the delegate an opportunity to adjust the application's user interface to editing mode. When the table exits editing mode (for example, the user taps the Delete button), the table view calls tableView:didEndEditingRowAtIndexPath:.
Note: A swipe motion across a cell does not cause the display of a Delete button unless the table view's data source implements the tableView:commitEditingStyle:forRowAtIndexPath: method.
UITableView tableView willBeginEditingRowAtIndexPath example.
- (void)tableView:(UITableView *)aTableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath {
[super setEditing:isEditing animated:animated];
[self.tableView setEditing:isEditing animated:animated];
//Self.editing handles the done / edit button
self.editing = YES;
}
[super setEditing:isEditing animated:animated];
[self.tableView setEditing:isEditing animated:animated];
//Self.editing handles the done / edit button
self.editing = YES;
}
Example of [UITableView tableView willBeginEditingRowAtIndexPath].
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"tableView canEditRowAt...");
return YES;
}
- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"tableView willBeginEditingRowAtIndexPath: %@", indexPath);
}
- (void)tableView:(UITableView *)tableView willEndEditingRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"tableView willEndEditingRowAtIndexPath: %@", indexPath);
}
NSLog(@"tableView canEditRowAt...");
return YES;
}
- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"tableView willBeginEditingRowAtIndexPath: %@", indexPath);
}
- (void)tableView:(UITableView *)tableView willEndEditingRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"tableView willEndEditingRowAtIndexPath: %@", indexPath);
}
UITableView tableView willBeginEditingRowAtIndexPath example.
-(void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"WILL BEGIN EDITING");
[self.tableView setEditing:YES animated:YES];
}
-(void)tableView:(UITableView*)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.tableView setEditing:NO animated:YES];
}
{
NSLog(@"WILL BEGIN EDITING");
[self.tableView setEditing:YES animated:YES];
}
-(void)tableView:(UITableView*)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.tableView setEditing:NO animated:YES];
}