nick shmick
nick shmick

Reputation: 925

How to recognise when a finger was lifted from the screen?

I have a scroll view that I'm using its delegate method:

(void)scrollViewDidScroll:(UIScrollView *)scrollView

And I want to perform some action after my content offset is at some point, and the finger was pulled from the screen....How do I find out if the finger was lifted?

this is what I have so far:

if (self.myScrollView.contentOffset.y <= -73 && HereINeedToFindOutIfTheFingerWasLifted)

Thanks!!!

Upvotes: 0

Views: 444

Answers (2)

Danny Daglas
Danny Daglas

Reputation: 1491

I suggest your delegate implement the

-(void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset

method and have it set some BOOL instance variable (i.e., fingerWasLifted = YES;). Then, reset it by executing fingerWasLifted = NO; in the

-(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView;

method.

Upvotes: 1

Adama
Adama

Reputation: 1097

You can try the method:

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate

This fires when the user stops manually dragging, but the scrollview may still be decelerating.

Upvotes: 1

Related Questions