if ([self  class] == [HomeViewController class]||[self  class] == [ComprehensivefinanceViewController class]||[self  class] == [MyCenterViewController class]||[self  class] == [CustomerManageViewController class]) {

//添加左扫和右扫手势

UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(tappedRightButton:)];

[swipeLeft setDirection:UISwipeGestureRecognizerDirectionLeft];

[self.view addGestureRecognizer:swipeLeft];

UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(tappedLeftButton:)];

[swipeRight setDirection:UISwipeGestureRecognizerDirectionRight];

[self.view addGestureRecognizer:swipeRight];

//在基类的控制器里面书写   给主控制器加轻扫手势监听

- (IBAction) tappedRightButton:(id)sender

{

NSUInteger selectedIndex = [self.tabBarController selectedIndex];

NSArray *aryViewController = self.tabBarController.viewControllers;

if (selectedIndex < aryViewController.count - 1) {

//        UIView *fromView = [self.tabBarController.selectedViewController view];

//

//        UIView *toView = [[self.tabBarController.viewControllers objectAtIndex:selectedIndex + 1] view];

//

//        [UIView transitionFromView:fromView toView:toView duration:0.5f options:UIViewAnimationOptionTransitionFlipFromRight completion:^(BOOL finished) {

//

//            if (finished) {

[self.tabBarController setSelectedIndex:selectedIndex + 1];

//            }

//

//        }];

}

}

- (IBAction) tappedLeftButton:(id)sender

{

NSUInteger selectedIndex = [self.tabBarController selectedIndex];

if (selectedIndex > 0) {

//        UIView *fromView = [self.tabBarController.selectedViewController view];

//

//        UIView *toView = [[self.tabBarController.viewControllers objectAtIndex:selectedIndex - 1] view];

//        [UIView transitionFromView:fromView toView:toView duration:0.5f options:UIViewAnimationOptionTransitionFlipFromLeft completion:^(BOOL finished) {

//

//            if (finished) {

[self.tabBarController setSelectedIndex:selectedIndex - 1];

//            }

//

//        }];

}

}

//这样就可以  全局滑动返回

若是网页控制器实现滑动返回功能  就得在WKWebview实现

_wkWebView.allowsBackForwardNavigationGestures = YES;//打开webview页面的滑动返回

}else{

self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;

}

//就是这么简单

最新文章

  1. 使用CSS设置行间距,字间距.
  2. css3 妙味
  3. 几种在Linux下查询外网IP的办法
  4. weblogic 下载安装部署说明
  5. python多进程的理解 multiprocessing Process join run
  6. Java原生API操作XML
  7. Rigidbody(刚体) and Collider(碰撞器)
  8. VB 用代码创建的控件和接收事件
  9. Eclipse配置SpringBoot
  10. MT 互联网 面试标准
  11. 结合JDK源码看设计模式——享元模式
  12. 清明培训 清北学堂 DAY1
  13. HNOI2006公路修建问题
  14. JavaScript Dom 事件
  15. Winform开发框架之通用Windows摄像头调用拍照--SNF快速开发平台3.3-Spring.Net.Framework
  16. (转载)windows下安装配置Xampp
  17. js 排序,去重
  18. SharePoint PowerShell使用Export-SPWeb和Import-SPWeb指令来导出和导入网站
  19. C# 对象哈希码
  20. 【bzoj1078】 SCOI2008—斜堆

热门文章

  1. Ubuntu下搜狗拼音突然无法输入中文的解决办法
  2. 多线程编程学习笔记——async和await(三)
  3. 「mysql优化专题」视图应用竟然还可以这么优化?不得不收藏(8)
  4. 《C++程序设计语言(十周年纪念版)》【PDF】下载
  5. 写给自己的web总结——css篇(1)
  6. 查看系统分区df,查看、设置、修改、删除ACL权限
  7. 串String(2):串的实现(堆分配存储表示法)
  8. sql server 2012 新知识-序列
  9. 通过 备份文件 恢复/迁移 gitlab
  10. 环形进度条的实现方法总结和动态时钟绘制(CSS3、SVG、Canvas)