0

I would like to make use of the drag and drop reordering of tableview cells, but I have one problem:

I would like to keep my first row in place!

Here is the canMoveRowAtIndexPath delegate function:

- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row==0) {
        return NO;
    }
    return YES;
}

If I do it like this, the first row can not be dragged, BUT you can still drag another row on top of it! Is there any way to prevent cells from dropping 'above' this row?

Nils Ziehn
  • 4,118
  • 6
  • 26
  • 40

2 Answers2

1

Your answer is hear, You can use these step.

Examples of Moving a Row

SAMIR RATHOD
  • 3,512
  • 1
  • 20
  • 45
0

check if it is a drag and cancel the scrolling if it is = [uitableview setScrollEnabled:NO]

read this thread, it will help you i hope

Tutorial on How to drag and drop item from UITableView to UITableView

Community
  • 1
  • 1
james075
  • 1,280
  • 1
  • 12
  • 22