iOS 百度地图与侧滑返回冲突


正常这样就行

在这里关闭

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    if([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = NO;
    }
}
  • 进入下个页面或者返回上一个页面时,启用侧滑手势:
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    if([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    }
}

但在地图页面就不行了

需要如下:

在viewDIdLoad添加

id traget = self.navigationController.interactivePopGestureRecognizer.delegate;
    UIPanGestureRecognizer * pan = [[UIPanGestureRecognizer alloc]initWithTarget:traget action:nil];
    pan.cancelsTouchesInView = NO;
    pan.delaysTouchesEnded = NO;
    [self.view addGestureRecognizer:pan];

 

你可能感兴趣的:(iOS 百度地图与侧滑返回冲突)