天天看点

iOS 左滑返回与UIScrollView左右滑动冲突

0x00

一行代码:

[_scrollView.panGestureRecognizer requireGestureRecognizerToFail:self.navigationController.interactivePopGestureRecognizer];      

还应该在生命周期方法内处理一下:

- (void)viewDidDisappear:(BOOL)animated{
    [super viewDidDisappear:animated];   
    self.navigationController.interactivePopGestureRecognizer.enabled = YES;
}      

0x01

NSArray *gestureArray = self.navigationController.view.gestureRecognizers;
    for (UIGestureRecognizer *gesture in gestureArray) {
        if ([gesture isKindOfClass:[UIScreenEdgePanGestureRecognizer class]]) {
            [_scrollView.panGestureRecognizer requireGestureRecognizerToFail:gesture];
        }
    }      

这个心形遮罩有点意思