1.首先把顶部左侧返回按钮隐藏掉
- //隐藏返回按钮
- self.navigationItem.hidesBackButton = YES;
2.1.再禁止页面左侧侧
- //禁止页面左侧滑动返回,注意,如果仅仅需要禁止此单个页面返回,还需要在viewWillDisapper下开放侧滑权限
- // 禁用返回手势
- if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
- self.navigationController.interactivePopGestureRecognizer.enabled = NO;
- }
2.2.如果需要仅仅此界面禁止返回,其他界面正常的话,需要在页面即将消失的时候开放侧滑
- // 开启返回手势
- if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
- self.navigationController.interactivePopGestureRecognizer.enabled = YES;
- }