0

我的 ECSlidingViewController 工作正常,但我想以这样一种方式实现它,即当用户尝试从标题部分滑动时,不会执行用户尝试滑动操作。

我只需要应用程序的主体部分来响应滑动手势

4

1 回答 1

0

我就是这样做的。locationRect 和 locationrect2 是您希望启用手势的部分。

- (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;
}

}

于 2014-02-12T11:18:01.860 回答