您的位置:首页 > 产品设计 > UI/UE

解决interactivePopGestureRecognizer与UIPanGestureRecognizer冲突

2015-07-30 14:55 561 查看
在当前vc里添加

self.navigationController.interactivePopGestureRecognizer.enabled
= YES;
self.navigationController.interactivePopGestureRecognizer.delegate
= self;

UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer
alloc] initWithTarget:self
action:@selector(handlePan:)];
panGesture.delegate =
self;
[view
addGestureRecognizer:panGesture];

设置Delegate

#pragma UIGestureRecognizerDelegate

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer
*)otherGestureRecognizer
{
    return [gestureRecognizer
isKindOfClass:UIScreenEdgePanGestureRecognizer.class];
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer
*)otherGestureRecognizer
{
    return
YES;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息