How can I detect which way the user swiped my page view controller? This should be simple but I cannot seem to find a reliable way to do this! Can anyone help me with a simple answer to tell which way the user has swiped a page!
Thanks.
How can I detect which way the user swiped my page view controller? This should be simple but I cannot seem to find a reliable way to do this! Can anyone help me with a simple answer to tell which way the user has swiped a page!
Thanks.
There could be functions like first touch and last touch. So you can understand the direction by simple aritmetical operations. Then swipe won't be too different initial and ending point are key elements for understanding the direction as well.
I assume you have already checked it but may missed little details.
Here - Apple Developers Site
Left swipe used this:
UISwipeGestureRecognizer* leftSwipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleLeftSwipe:)];
leftSwipeRecognizer.direction = UISwipeGestureRecognizerDirectionLeft;
[self.tableView addGestureRecognizer:leftSwipeRecognizer];
Right swipe used this:
UISwipeGestureRecognizer* rightSwipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleRightSwipe:)];
rightSwipeRecognizer.direction = UISwipeGestureRecognizerDirectionRight;
[self.tableView addGestureRecognizer:rightSwipeRecognizer];