iOS App用WKWebView加载h5, h5多页面手势返回,h5返回App
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
此文仅为鄙人学习笔记之用,朋友你来了,如有不明白或者建议又或者想给我指点一二,请私信我。liuw_flexi@163.com/QQ群:582039935.
我的gitHub: (学习代码都在gitHub)
https://github.com/nwgdegitHub/