Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
0ea84172
Commit
0ea84172
authored
Apr 22, 2024
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决复杂UI布局下 滑动返回失效问题
parent
8804d264
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
25 deletions
+76
-25
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+4
-0
YHBaseViewController.swift
galaxy/galaxy/Classes/Base/C/YHBaseViewController.swift
+33
-2
YHNavigationController.swift
galaxy/galaxy/Classes/Base/C/YHNavigationController.swift
+7
-0
YHServiceListViewController.swift
...elligentService(服务中心)/C/YHServiceListViewController.swift
+1
-0
YHServiceViewController.swift
.../IntelligentService(服务中心)/C/YHServiceViewController.swift
+5
-23
UIScrollView+Extension.swift
...laxy/Classes/Tools/Extention/UIScrollView+Extension.swift
+26
-0
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
0ea84172
...
@@ -220,6 +220,7 @@
...
@@ -220,6 +220,7 @@
045EEF232B9F171A0022A143
/* YHItemView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
045EEE762B9F171A0022A143
/* YHItemView.swift */
;
};
045EEF232B9F171A0022A143
/* YHItemView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
045EEE762B9F171A0022A143
/* YHItemView.swift */
;
};
045EEF242B9F171A0022A143
/* YHStepView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
045EEE772B9F171A0022A143
/* YHStepView.swift */
;
};
045EEF242B9F171A0022A143
/* YHStepView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
045EEE772B9F171A0022A143
/* YHStepView.swift */
;
};
045EEF252B9F171A0022A143
/* YHMainInformationCardTableViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
045EEE782B9F171A0022A143
/* YHMainInformationCardTableViewCell.swift */
;
};
045EEF252B9F171A0022A143
/* YHMainInformationCardTableViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
045EEE782B9F171A0022A143
/* YHMainInformationCardTableViewCell.swift */
;
};
04684A7F2BD6520A007D95B8
/* UIScrollView+Extension.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04684A7E2BD6520A007D95B8
/* UIScrollView+Extension.swift */
;
};
0468D4202B49320900CFB916
/* YHVerificationCodeLoginController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0468D41F2B49320900CFB916
/* YHVerificationCodeLoginController.swift */
;
};
0468D4202B49320900CFB916
/* YHVerificationCodeLoginController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0468D41F2B49320900CFB916
/* YHVerificationCodeLoginController.swift */
;
};
0468D4222B493A5E00CFB916
/* YHPhoneMessageView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0468D4212B493A5E00CFB916
/* YHPhoneMessageView.swift */
;
};
0468D4222B493A5E00CFB916
/* YHPhoneMessageView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0468D4212B493A5E00CFB916
/* YHPhoneMessageView.swift */
;
};
0468D4242B494BEA00CFB916
/* YHCodeResultViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0468D4232B494BEA00CFB916
/* YHCodeResultViewController.swift */
;
};
0468D4242B494BEA00CFB916
/* YHCodeResultViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0468D4232B494BEA00CFB916
/* YHCodeResultViewController.swift */
;
};
...
@@ -669,6 +670,7 @@
...
@@ -669,6 +670,7 @@
045EEE762B9F171A0022A143
/* YHItemView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHItemView.swift
;
sourceTree
=
"<group>"
;
};
045EEE762B9F171A0022A143
/* YHItemView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHItemView.swift
;
sourceTree
=
"<group>"
;
};
045EEE772B9F171A0022A143
/* YHStepView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHStepView.swift
;
sourceTree
=
"<group>"
;
};
045EEE772B9F171A0022A143
/* YHStepView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHStepView.swift
;
sourceTree
=
"<group>"
;
};
045EEE782B9F171A0022A143
/* YHMainInformationCardTableViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHMainInformationCardTableViewCell.swift
;
sourceTree
=
"<group>"
;
};
045EEE782B9F171A0022A143
/* YHMainInformationCardTableViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHMainInformationCardTableViewCell.swift
;
sourceTree
=
"<group>"
;
};
04684A7E2BD6520A007D95B8
/* UIScrollView+Extension.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"UIScrollView+Extension.swift"
;
sourceTree
=
"<group>"
;
};
0468D41F2B49320900CFB916
/* YHVerificationCodeLoginController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHVerificationCodeLoginController.swift
;
sourceTree
=
"<group>"
;
};
0468D41F2B49320900CFB916
/* YHVerificationCodeLoginController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHVerificationCodeLoginController.swift
;
sourceTree
=
"<group>"
;
};
0468D4212B493A5E00CFB916
/* YHPhoneMessageView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPhoneMessageView.swift
;
sourceTree
=
"<group>"
;
};
0468D4212B493A5E00CFB916
/* YHPhoneMessageView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPhoneMessageView.swift
;
sourceTree
=
"<group>"
;
};
0468D4232B494BEA00CFB916
/* YHCodeResultViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCodeResultViewController.swift
;
sourceTree
=
"<group>"
;
};
0468D4232B494BEA00CFB916
/* YHCodeResultViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCodeResultViewController.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -2029,6 +2031,7 @@
...
@@ -2029,6 +2031,7 @@
A5ACE9032B4564F7002C94D2
/* UILable+Extension.swift */
,
A5ACE9032B4564F7002C94D2
/* UILable+Extension.swift */
,
A5ACE9042B4564F7002C94D2
/* Array+Extension.swift */
,
A5ACE9042B4564F7002C94D2
/* Array+Extension.swift */
,
04754A942B96FF3D00F8ADCA
/* UITextField+Extension.swift */
,
04754A942B96FF3D00F8ADCA
/* UITextField+Extension.swift */
,
04684A7E2BD6520A007D95B8
/* UIScrollView+Extension.swift */
,
);
);
path
=
Extention
;
path
=
Extention
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -2516,6 +2519,7 @@
...
@@ -2516,6 +2519,7 @@
A5173D682BC399B9007D4E74
/* YHHomePageViewController.swift in Sources */
,
A5173D682BC399B9007D4E74
/* YHHomePageViewController.swift in Sources */
,
045EEF0E2B9F171A0022A143
/* YHBasicInfoFillView.swift in Sources */
,
045EEF0E2B9F171A0022A143
/* YHBasicInfoFillView.swift in Sources */
,
045EEEA12B9F171A0022A143
/* YHWorkExperienceDetailModel.swift in Sources */
,
045EEEA12B9F171A0022A143
/* YHWorkExperienceDetailModel.swift in Sources */
,
04684A7F2BD6520A007D95B8
/* UIScrollView+Extension.swift in Sources */
,
A5573ED22B317BFF00D98EC0
/* AppDelegate.swift in Sources */
,
A5573ED22B317BFF00D98EC0
/* AppDelegate.swift in Sources */
,
A5ACE9542B4564F7002C94D2
/* YHNavigationController.swift in Sources */
,
A5ACE9542B4564F7002C94D2
/* YHNavigationController.swift in Sources */
,
045EEF252B9F171A0022A143
/* YHMainInformationCardTableViewCell.swift in Sources */
,
045EEF252B9F171A0022A143
/* YHMainInformationCardTableViewCell.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Base/C/YHBaseViewController.swift
View file @
0ea84172
...
@@ -28,8 +28,7 @@ class YHBaseViewController: UIViewController {
...
@@ -28,8 +28,7 @@ class YHBaseViewController: UIViewController {
#if DEBUG
#if DEBUG
IQKeyboardManager
.
shared
.
enable
=
true
IQKeyboardManager
.
shared
.
enable
=
true
#endif
#endif
navigationController
?
.
interactivePopGestureRecognizer
?
.
delegate
=
self
}
}
override
var
prefersStatusBarHidden
:
Bool
{
override
var
prefersStatusBarHidden
:
Bool
{
...
@@ -45,4 +44,36 @@ class YHBaseViewController: UIViewController {
...
@@ -45,4 +44,36 @@ class YHBaseViewController: UIViewController {
printLog
(
#function
)
printLog
(
#function
)
#endif
#endif
}
}
func
popGestureClose
()
{
if
let
ges
=
self
.
navigationController
?
.
interactivePopGestureRecognizer
?
.
view
?
.
gestureRecognizers
{
for
item
in
ges
{
item
.
isEnabled
=
false
}
}
}
func
popGestureOpen
()
{
if
let
ges
=
self
.
navigationController
?
.
interactivePopGestureRecognizer
?
.
view
?
.
gestureRecognizers
{
for
item
in
ges
{
item
.
isEnabled
=
false
}
}
}
func
gestureRecognizer
(
_
gestureRecognizer
:
UIGestureRecognizer
,
shouldRecognizeSimultaneouslyWith
otherGestureRecognizer
:
UIGestureRecognizer
)
->
Bool
{
if
children
.
count
==
1
{
return
false
}
else
{
return
true
}
}
}
extension
YHBaseViewController
:
UIGestureRecognizerDelegate
{
// 这个方法是在手势将要激活前调用
// 返回YES允许右滑手势的激活,返回NO不允许右滑手势的激活
func
gestureRecognizerShouldBegin
(
_
gestureRecognizer
:
UIGestureRecognizer
)
->
Bool
{
return
true
}
}
}
galaxy/galaxy/Classes/Base/C/YHNavigationController.swift
View file @
0ea84172
...
@@ -10,6 +10,13 @@ import UIKit
...
@@ -10,6 +10,13 @@ import UIKit
class
YHNavigationController
:
UINavigationController
{
class
YHNavigationController
:
UINavigationController
{
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
guard
let
targets
=
interactivePopGestureRecognizer
?
.
value
(
forKey
:
"_targets"
)
as?
[
NSObject
]
else
{
return
}
let
targetObjc
=
targets
[
0
]
let
target
=
targetObjc
.
value
(
forKey
:
"target"
)
let
action
=
Selector
((
"handleNavigationTransition:"
))
let
panges
=
UIPanGestureRecognizer
(
target
:
target
,
action
:
action
)
view
.
addGestureRecognizer
(
panges
)
}
}
override
func
pushViewController
(
_
viewController
:
UIViewController
,
animated
:
Bool
)
{
override
func
pushViewController
(
_
viewController
:
UIViewController
,
animated
:
Bool
)
{
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/C/YHServiceListViewController.swift
View file @
0ea84172
...
@@ -46,6 +46,7 @@ class YHServiceListViewController: YHBaseViewController {
...
@@ -46,6 +46,7 @@ class YHServiceListViewController: YHBaseViewController {
super
.
viewWillAppear
(
animated
)
super
.
viewWillAppear
(
animated
)
loadData
()
loadData
()
}
}
}
}
extension
YHServiceListViewController
{
extension
YHServiceListViewController
{
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/C/YHServiceViewController.swift
View file @
0ea84172
...
@@ -11,13 +11,6 @@ import JXSegmentedView
...
@@ -11,13 +11,6 @@ import JXSegmentedView
class
YHServiceViewController
:
YHBaseViewController
{
class
YHServiceViewController
:
YHBaseViewController
{
var
canScroll
:
Bool
=
false
{
didSet
{
for
vc
in
arrItemVCs
{
}
}
}
var
defaltIndex
:
Int
=
0
var
defaltIndex
:
Int
=
0
let
arrItemTitles
=
[
"香港身份"
,
"香港生活"
]
let
arrItemTitles
=
[
"香港身份"
,
"香港生活"
]
...
@@ -83,7 +76,6 @@ class YHServiceViewController: YHBaseViewController {
...
@@ -83,7 +76,6 @@ class YHServiceViewController: YHBaseViewController {
//segmentedViewDataSource一定要通过属性强持有!!!!!!!!!
//segmentedViewDataSource一定要通过属性强持有!!!!!!!!!
segmentedView
.
dataSource
=
segmentedDataSource
segmentedView
.
dataSource
=
segmentedDataSource
segmentedView
.
delegate
=
self
segmentedView
.
collectionView
.
backgroundColor
=
.
white
segmentedView
.
collectionView
.
backgroundColor
=
.
white
view
.
addSubview
(
segmentedView
)
view
.
addSubview
(
segmentedView
)
...
@@ -134,26 +126,16 @@ class YHServiceViewController: YHBaseViewController {
...
@@ -134,26 +126,16 @@ class YHServiceViewController: YHBaseViewController {
listContainerView
.
frame
=
CGRect
(
x
:
0
,
y
:
k_Height_safeAreaInsetsTop
()
+
48
,
width
:
view
.
bounds
.
size
.
width
,
height
:
view
.
bounds
.
size
.
height
-
48
-
k_Height_safeAreaInsetsTop
())
listContainerView
.
frame
=
CGRect
(
x
:
0
,
y
:
k_Height_safeAreaInsetsTop
()
+
48
,
width
:
view
.
bounds
.
size
.
width
,
height
:
view
.
bounds
.
size
.
height
-
48
-
k_Height_safeAreaInsetsTop
())
}
}
}
}
extension
YHServiceViewController
{
func
jumpToItemIndex
(
itemIndex
:
Int
)
{
self
.
segmentedView
.
selectItemAt
(
index
:
itemIndex
)
}
}
extension
YHServiceViewController
:
JXSegmentedViewDelegate
{
extension
YHServiceViewController
:
JXSegmentedViewDelegate
{
func
segmentedView
(
_
segmentedView
:
JXSegmentedView
,
didSelectedItemAt
index
:
Int
)
{
func
segmentedView
(
_
segmentedView
:
JXSegmentedView
,
didSelectedItemAt
index
:
Int
)
{
// NotificationCenter.default.post(name: Notification.Name(rawValue: "scrollViewDidEndDragging"), object: nil
)
navigationController
?
.
interactivePopGestureRecognizer
?
.
isEnabled
=
(
segmentedView
.
selectedIndex
==
0
)
}
}
}
/// 正在滚动中的回调
extension
YHServiceViewController
{
///
func
jumpToItemIndex
(
itemIndex
:
Int
)
{
/// - Parameters:
self
.
segmentedView
.
selectItemAt
(
index
:
itemIndex
)
/// - segmentedView: JXSegmentedView
/// - leftIndex: 正在滚动中,相对位置处于左边的index
/// - rightIndex: 正在滚动中,相对位置处于右边的index
/// - percent: 从左往右计算的百分比
func
segmentedView
(
_
segmentedView
:
JXSegmentedView
,
scrollingFrom
leftIndex
:
Int
,
to
rightIndex
:
Int
,
percent
:
CGFloat
)
{
// NotificationCenter.default.post(name: Notification.Name(rawValue: "scrollViewWillBeginDragging"), object: nil)
}
}
}
}
...
...
galaxy/galaxy/Classes/Tools/Extention/UIScrollView+Extension.swift
0 → 100644
View file @
0ea84172
//
// YHViewController.swift
// galaxy
//
// Created by EDY on 2024/4/22.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
extension
UIScrollView
{
// 解决有UIScrollView时不能在屏幕左边侧滑返回
open
override
func
gestureRecognizerShouldBegin
(
_
gestureRecognizer
:
UIGestureRecognizer
)
->
Bool
{
// 过滤UITextView(因为UITextView继承自UIScrollView),否则会引起崩溃
if
(
gestureRecognizer
.
view
?
.
isMember
(
of
:
UITextView
.
self
))
!
{
return
true
}
let
velocity
=
(
gestureRecognizer
as!
UIPanGestureRecognizer
)
.
velocity
(
in
:
self
)
let
location
=
gestureRecognizer
.
location
(
in
:
self
)
if
(
velocity
.
x
>
0.0
&&
Int
(
location
.
x
)
%
Int
(
UIScreen
.
main
.
bounds
.
size
.
width
)
<
60
)
{
return
false
}
return
true
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment