iOS开发之禁用ios7 手势滑动返回功能

  1. 在有的时候,我们不需要手势返回功能,那么可以在页面中添加以下代码:  
[objc]  view plain copy print ?
  1. - (void)viewDidAppear:(BOOL)animated  
  2. {  
  3.     [super viewDidAppear:animated];  
  4.   
  5.     // 禁用 iOS7 返回手势  
  6.     if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {  
  7.         self.navigationController.interactivePopGestureRecognizer.enabled = NO;  
  8.     }  
  9. }  
  10.   
  11. - (void)viewWillDisappear:(BOOL)animated  
  12. {  
  13.     [super viewWillDisappear:animated];  
  14.   
  15.     // 开启  
  16.     if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {  
  17.         self.navigationController.interactivePopGestureRecognizer.enabled = YES;  
  18.     }  
  19. }  


有兴趣的朋友请加QQ群:52961740 

你可能感兴趣的:(ios7,手势)