Avba
Avba

Reputation: 15266

UIScrollView isDragging returns YES when no scrollview is decelerating

I want to know if a UIScrollView (UITableView) is dragging (panning) because the user's finger is actively panning it (the user's finger is on the scrollview . i.e. on the screen) or because the scroll view was "flicked" and it is scrolling (i.e 'decelerating' per UIScrollView default behavior)

I tried checking for

[self.tableView isDragging]

and unfortunately this returns 'YES' in both cases

Then how can I decide if the user's finger is on the 'screen' - and panning?

Upvotes: 3

Views: 2527

Answers (3)

Jack Patoliya
Jack Patoliya

Reputation: 517

Using your scroll view delegate you are achieve this.

 - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate;
 - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView;   
// called on finger up as we are moving

 - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView; here

Upvotes: 2

Thukaram
Thukaram

Reputation: 1083

Instead of using isDragging use isTracking for touch recognising on UITableView.

Or

if you want to recognize dragging ofUITableview use scrollview delegate methods.

Upvotes: 9

Azerue
Azerue

Reputation: 368

Try using uiscrollView Delegate. You will get call here when user is panning

– scrollViewDidScroll:

Upvotes: -1

Related Questions