1. 创建webView时使用:作用是允许h5多页面,手势滑动
wkWebView.allowsBackForwardNavigationGestures = true
2. 因为App系统自带侧滑手势返回,所以要这样做:
//监听侧滑手势 let swiperGesture = UISwipeGestureRecognizer(target: self, action: #selector(handleNavigationTransition(_:))) swiperGesture.delegate = self // 设置手势代理,拦截手势触发 view.addGestureRecognizer(swiperGesture) navigationController?.interactivePopGestureRecognizer?.isEnabled = true navigationController?.interactivePopGestureRecognizer?.delegate = self