CanMoveRowAtIndexPath is not called - but canEditRowAtIndexPath does

Very simple. I do not understand. When the table loads, and when Edit switches, canEdit is called, but not canMove . What am I doing wrong?

 - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"canEdit=%d", indexPath.row); // output is as expected, "canEdit" for each row return (indexPath.section == 1) ? YES : NO; } - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"canMove=%d", indexPath.row); // nothing. No output return (indexPath.section == 1) ? YES : NO; } 

Thanks!

+4
source share
1 answer

Sorry, this problem was answered:

Order control is not displayed as a table

You must also implement

 - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath 

Swift

 func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool { return true } func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) { //code } 
+13
source

All Articles