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

  • Post author:
  • Post category:其他



正常这样就行

在这里关闭

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



版权声明:本文为aa122273328原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。