iOS navigationController自定义返回后系统滑动返回失效的解决办法

环境
Xcode7.2 iOS10
在Push后加上
VC.navigationController.interactivePopGestureRecognizer.delegate = nil;

    [self.viewController.navigationController pushViewController:VC animated:YES];
    VC.navigationController.interactivePopGestureRecognizer.delegate = nil;

或者在viewDidLoad方法里写

- (void)viewDidLoad {
 [super viewDidLoad]; //重点 
  self.navigationController.interactivePopGestureRecognizer.delegate = nil;
}

因为覆盖了系统的返回按钮事件,系统将会通过代理禁用这个滑动返回功能,提前取消系统的delegate,这样滑动返回功能就OK了。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容