0

I have ECSlidingViewController working perfectly but I want to implement it in such a way that when the user tries to swipe action is not carried out when the user tries to swipe from the header section.

I only require the body portion of the app to respond to the swipe gecture

Royston Yinkore
  • 561
  • 1
  • 8
  • 22

1 Answers1

0

This is how i did it. locationRect and locationrect2 is the portion where you want the gesture to be enabled.

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
CGRect locationRect;
CGRect locationRect2;
locationRect = CGRectMake(0, 0,60, self.view.frame.size.height);
locationRect2 = CGRectMake(self.view.frame.size.width-60, 0,60,self.view.frame.size.height);
CGPoint p = [gestureRecognizer locationInView:self.view];

if (CGRectContainsPoint(locationRect, p) || CGRectContainsPoint(locationRect2, p)) {

    return YES;
} else {

    return  NO;
}

}

  • Thanks for the reply. We've moved a long way from that project but I'd try to implement and mark as answered if it works. Thanks a lot :) – Royston Yinkore Feb 20 '14 at 11:28