0

|

---- self.view

|

-------- UIView (A)

|

------------ UITableView

|

---------------- UIView (B)

|

I've this hierarchy, added UISwipeGestureRecognizer on UIView (B), I've given all four directions for the swipe gesture, however it could only detects left and right directions, when I tried for up and down side swipe UITableView scrolls, what should I do to recognize swipe instead of doing table scroll?

I did the following (individually) after googled, but it wont work.

swipeUp.cancelsTouchesInView = NO; //swipeUp is UISwipeGestureRecognizer

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    return YES;
}

I can't disable/enable table scrolling as there're other views to show.

Hemang
  • 26,840
  • 19
  • 119
  • 186

1 Answers1

0

You can disable TableView scrolling while showing View B by:

 table.scrollEnabled = NO;

This will prevent the table view to scroll. Don't forget to enable tableview scrolling after hiding view B. For this you need to do is:

 table.scrollEnabled = YES;

EDIT:

You can have a look at

- (BOOL) gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch

From this delegate you can determine the gesture is working on which view. Have a look at this post.

Hope this help. :)

Community
  • 1
  • 1
Rashad
  • 11,057
  • 4
  • 45
  • 73