• 禁用手势返回
- (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;  
    }  
}  

相关文章:

  • 2022-01-30
  • 2021-08-08
  • 2022-12-23
  • 2021-12-31
  • 2021-10-10
  • 2018-01-04
  • 2021-11-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案