Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to scroll UITableView while dragging UITableViewCell? #85

Open
KalpeshTalkar opened this issue Nov 18, 2016 · 3 comments
Open

How to scroll UITableView while dragging UITableViewCell? #85

KalpeshTalkar opened this issue Nov 18, 2016 · 3 comments

Comments

@KalpeshTalkar
Copy link

Drag and drop does not scroll the UITableView. How to implement the scrolling functionality while dragging?

@SteveFortune
Copy link
Member

I'm not sure about this - do you mean the table should scroll down when you're dragging a cell to the bottom of a list?

Thanks,
Steve.

@KalpeshTalkar
Copy link
Author

Exactly. The table should scroll up/down while dragging the cell.
Currently, the table does not scroll while dragging the cell.
How can I make the table scroll if I want to drag a cell from first position to the last position or from last position to first position?

@SteveFortune
Copy link
Member

SteveFortune commented Nov 19, 2016

Hmm OK. The framework doesn't offer this out of the box, but I'm fairly confident you should be able to build it in to your app. Off the top of my head, you could attach your own UIPanGestureRecognizers to a table view (see here) which could use its own UIGestureRecognizerDelegate to detect when the user pans over the bottom of the table and automatically scroll it. E.g. here is some pseudocode:

- (void)handlePan:(UIGestureRecognizer *)recognizer {
    if (_coordinator.currentDraggingCollection == _myTable && /* _coordinator.currentDragOrigin is inside the bottom of the table */) {
        [_myTable setContentOffset:/* some offset - maybe _coordinator.currentDragOrigin? */ animated:@YES];
    }
}

What do you think?

Thanks,
Steve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants