0

I am implementing changing order functionality in my UITableView. I've already set MyTableView.Editing = true;.

I wonder if there is an event/method saying that I've started moving the row and an event saying that I ended it up?

I've already checked: BeginUpdates(), EndUpdates() and they don't look like working. Does anyone have any ideas?

manishsharma93
  • 1,039
  • 1
  • 11
  • 26
lawiluk
  • 577
  • 4
  • 13
  • https://stackoverflow.com/questions/9898388/how-to-get-notified-of-uitableviewcell-move-start-and-end – Yatendra Aug 01 '19 at 09:44
  • I test those functions and found there seems no function for you to detect when starting moving the row. – nevermore Aug 20 '19 at 05:39

1 Answers1

-1

In UITableview, UITableViewDelegate will receive the following methods when reordering actions:

      - (void)tableView:(UITableView *)tableView willBeginReorderingRowAtIndexPath:(NSIndexPath *)indexPath;
      - (void)tableView:(UITableView *)tableView didEndReorderingRowAtIndexPath:(NSIndexPath *)indexPath;
      - (void)tableView:(UITableView *)tableView didCancelReorderingRowAtIndexPath:(NSIndexPath *)indexPath;

In swift may be following will help

func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {

}
func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {

}
Ankit Kushwah
  • 539
  • 4
  • 16