美文网首页
FDFullscreenPopGesture取消单页面侧滑操作

FDFullscreenPopGesture取消单页面侧滑操作

作者: Cyan_Queen | 来源:发表于2017-12-18 09:55 被阅读0次

    1.通用取消侧滑手势,添加一个拖动手势覆盖侧滑

    id traget = self.navigationController.interactivePopGestureRecognizer.delegate;

    UIPanGestureRecognizer * pan = [[UIPanGestureRecognizer alloc]initWithTarget:traget action:nil];

    [self.view addGestureRecognizer:pan];

    2.页面有滑动操作,如地图拖动手势,如果使用上面的方法会让整个页面无滑动事件,此时可以使用FDFullscreenPopGesture的属性设置,在页面显示的时候设置为无侧滑操作,页面消失时还原。

    - (void)viewWillAppear:(BOOL)animated{

    [super viewWillAppear:animated];

    self.navigationController.fd_fullscreenPopGestureRecognizer.enabled = NO;

    }

    -(void)viewWillDisappear:(BOOL)animated

    {

    [super viewWillDisappear:animated];

    self.navigationController.fd_fullscreenPopGestureRecognizer.enabled = YES;

    }

    相关文章

      网友评论

          本文标题:FDFullscreenPopGesture取消单页面侧滑操作

          本文链接:https://www.haomeiwen.com/subject/enupwxtx.html