Commit 3464e93f authored by Steven杜宇's avatar Steven杜宇

// 解决手势冲突

parent c7d93f9f
......@@ -12,6 +12,7 @@ import IQKeyboardManagerSwift
class YHAITabViewController: YHBaseViewController, UIGestureRecognizerDelegate {
var viewDidAppear: Bool = false
var defaltIndex: Int = 0
let viewModel = YHAIViewModel()
......@@ -110,34 +111,27 @@ class YHAITabViewController: YHBaseViewController, UIGestureRecognizerDelegate {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// 处于第一个item的时候,才允许屏幕边缘手势返回
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = (self.segmentedView.selectedIndex == 0)
self.gk_interactivePopDisabled = (self.segmentedView.selectedIndex != 0)
self.gk_fullScreenPopDisabled = (self.segmentedView.selectedIndex != 0)
requestList()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
viewDidAppear = true
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = (self.segmentedView.selectedIndex == 0)
self.gk_interactivePopDisabled = (self.segmentedView.selectedIndex != 0)
self.gk_fullScreenPopDisabled = (self.segmentedView.selectedIndex != 0)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
viewDidAppear = false
// 离开页面的时候,需要恢复屏幕边缘手势,不能影响其他页面
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = true
self.gk_interactivePopDisabled = false
self.gk_fullScreenPopDisabled = false
}
override func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
if self.segmentedView.selectedIndex == 0 {
self.gk_interactivePopDisabled = false
self.gk_fullScreenPopDisabled = false
return true
if gestureRecognizer == navigationController?.interactivePopGestureRecognizer {
if viewDidAppear {
return self.segmentedView.selectedIndex == 0
}
}
return false
}
......@@ -281,8 +275,6 @@ extension YHAITabViewController: JXSegmentedViewDelegate {
func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = (self.segmentedView.selectedIndex == 0)
self.gk_interactivePopDisabled = (self.segmentedView.selectedIndex != 0)
self.gk_fullScreenPopDisabled = (self.segmentedView.selectedIndex != 0)
if segmentedView.selectedIndex == 1 { // AI对话
bgImgView.isHidden = false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment