欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

iOS禁用右滑返回的兩種方法

 更新時間:2018年05月11日 15:56:11   作者:李會剛  
這篇文章主要為大家詳細(xì)介紹了iOS禁用右滑返回的兩種方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了iOS禁用右滑返回的具體代碼,供大家參考,具體內(nèi)容如下

方式一:

前提:如果使用的自定義UINavigationController基類,請不要在此基類里寫相關(guān)的手勢操作方法。

代碼如下:

-(void)viewDidAppear:(BOOL)animated{ 
  if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { 
    self.navigationController.interactivePopGestureRecognizer.enabled = NO; 
  } 
} 
   
-(void)viewWillDisappear:(BOOL)animated{ 
  self.navigationController.interactivePopGestureRecognizer.enabled = YES; 
} 

方式二:

流程:先設(shè)置代理---->重寫手勢操作方法

-(void)viewDidAppear:(BOOL)animated{ 
  self.navigationController.interactivePopGestureRecognizer.delegate = self; 
} 
   
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer 
                   *)gestureRecognizer{ 
  return NO; //YES:允許右滑返回 NO:禁止右滑返回 
} 

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論