控制器的左侧滑返回手势

开启此功能-----

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    
    // 在此决定是否开启左侧侧滑返回功能
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.delegate = nil;
        self.navigationController.interactivePopGestureRecognizer.enabled = self.navigationController.viewControllers.count - 1;
    }
}

关闭此功能-----

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    
    // 在此决定是否开启左侧侧滑返回功能
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = NO;
    }
}

 

posted @ 2017-12-15 15:23  码出境界  阅读(311)  评论(0编辑  收藏  举报