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
44205b7a
Commit
44205b7a
authored
Jan 19, 2024
by
David黄金龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 首页的 手势交互
parent
9d7d3720
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
60 deletions
+22
-60
ContentBaseViewController.swift
...lasses/Modules/Home(首页)/C/ContentBaseViewController.swift
+3
-22
YHDavidTestViewController.swift
...lasses/Modules/Home(首页)/C/YHDavidTestViewController.swift
+3
-15
YHHomeViewController.swift
...axy/Classes/Modules/Home(首页)/C/YHHomeViewController.swift
+16
-17
YHBbxCollectionViewCell.swift
.../Classes/Modules/Home(首页)/V/YHBbxCollectionViewCell.swift
+0
-1
YHDavidCell5.swift
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHDavidCell5.swift
+0
-3
YHHomeCustomCell.swift
.../galaxy/Classes/Modules/Home(首页)/V/YHHomeCustomCell.swift
+0
-2
No files found.
galaxy/galaxy/Classes/Modules/Home(首页)/C/ContentBaseViewController.swift
View file @
44205b7a
...
...
@@ -19,8 +19,6 @@ class ContentBaseViewController: UIViewController {
}
}
weak
var
myParentVC
:
YHHomeViewController
?
let
arrItemTitles
=
[
"推荐"
,
"子女教育"
,
"税务规划"
,
"民生医疗"
,
"成功案例"
,
"我的服务"
,
"行业资讯"
,
"香港生活"
,
"你我他"
,
"我是很长的tag呀"
]
...
...
@@ -46,16 +44,11 @@ class ContentBaseViewController: UIViewController {
//分类title 所对应的VC
lazy
var
listContainerView
:
JXSegmentedListContainerView
!
=
{
return
JXSegmentedListContainerView
(
dataSource
:
self
)
return
JXSegmentedListContainerView
(
dataSource
:
self
,
type
:
.
collectionView
)
}()
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
listContainerView
.
backgroundColor
=
.
purple
//for test hjl
listContainerView
.
scrollView
.
backgroundColor
=
.
red
//for test hjl
for
_
in
arrItemTitles
{
let
vc
=
YHDavidTestViewController
()
...
...
@@ -103,23 +96,12 @@ class ContentBaseViewController: UIViewController {
segmentedView
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
view
.
bounds
.
size
.
width
,
height
:
50
)
listContainerView
.
frame
=
CGRect
(
x
:
0
,
y
:
50
,
width
:
view
.
bounds
.
size
.
width
,
height
:
view
.
bounds
.
size
.
height
-
50
)
// view.backgroundColor = .purple//for test hjl
}
}
extension
ContentBaseViewController
:
JXSegmentedViewDelegate
{
func
segmentedView
(
_
segmentedView
:
JXSegmentedView
,
didSelectedItemAt
index
:
Int
)
{
navigationController
?
.
interactivePopGestureRecognizer
?
.
isEnabled
=
(
segmentedView
.
selectedIndex
==
0
)
// self.myParentVC?.tableViewCanScrollFlag = true
}
func
segmentedView
(
_
segmentedView
:
JXSegmentedView
,
didScrollSelectedItemAt
index
:
Int
)
{
printLog
(
"hjl- didScrollSelectedItemAt "
)
// self.myParentVC?.tableViewCanScrollFlag = true
NotificationCenter
.
default
.
post
(
name
:
Notification
.
Name
(
rawValue
:
"scrollViewDidEndDragging"
),
object
:
nil
)
}
/// 正在滚动中的回调
...
...
@@ -130,8 +112,7 @@ extension ContentBaseViewController: JXSegmentedViewDelegate {
/// - rightIndex: 正在滚动中,相对位置处于右边的index
/// - percent: 从左往右计算的百分比
func
segmentedView
(
_
segmentedView
:
JXSegmentedView
,
scrollingFrom
leftIndex
:
Int
,
to
rightIndex
:
Int
,
percent
:
CGFloat
)
{
printLog
(
"hjl- scrollingFrom [
\(
percent
)
] leftIndex=
\(
leftIndex
)
rightIndex=
\(
rightIndex
)
"
)
// self.myParentVC?.tableViewCanScrollFlag = false
NotificationCenter
.
default
.
post
(
name
:
Notification
.
Name
(
rawValue
:
"scrollViewWillBeginDragging"
),
object
:
nil
)
}
}
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHDavidTestViewController.swift
View file @
44205b7a
...
...
@@ -110,11 +110,7 @@ class YHDavidTestViewController: YHBaseViewController {
gk_navigationBar
.
isHidden
=
true
self
.
items
=
[
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
),
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
),
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
),
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
),
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
)]
self
.
items
=
[
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
)]
// self.myCollectView.es.stopPullToRefresh(ignoreDate: true,ignoreFooter: false)
self
.
myCollectView
.
reloadData
()
...
...
@@ -127,11 +123,7 @@ extension YHDavidTestViewController {
private
func
loadFirstItem
()
{
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
1
)
{
self
.
items
=
[
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
),
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
),
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
),
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
),
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
)]
self
.
items
=
[
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
)]
self
.
myCollectView
.
es
.
stopPullToRefresh
(
ignoreDate
:
true
,
ignoreFooter
:
false
)
self
.
myCollectView
.
reloadData
()
}
...
...
@@ -141,11 +133,7 @@ extension YHDavidTestViewController {
private
func
loadFakeData
()
{
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
1
)
{
self
.
items
.
append
(
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
))
self
.
items
.
append
(
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
))
self
.
items
.
append
(
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
))
self
.
items
.
append
(
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
))
self
.
items
.
append
(
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
))
self
.
items
.
append
(
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
))
self
.
myCollectView
.
es
.
stopLoadingMore
()
self
.
myCollectView
.
reloadData
()
}
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHHomeViewController.swift
View file @
44205b7a
...
...
@@ -21,7 +21,7 @@ class YHHomeViewController: YHBaseViewController {
var
myCellHeight
:
CGFloat
{
get
{
return
view
.
bounds
.
size
.
height
-
homeNavBarView
.
height
-
k_TabBar_Height
-
k_Height_NavigationtBarAndStatuBar
-
cellHeight
*
2
return
view
.
bounds
.
size
.
height
-
homeNavBarView
.
height
-
k_TabBar_Height
}
}
...
...
@@ -87,9 +87,9 @@ class YHHomeViewController: YHBaseViewController {
tableView
.
separatorStyle
=
.
none
tableView
.
showsHorizontalScrollIndicator
=
false
tableView
.
showsVerticalScrollIndicator
=
false
tableView
.
rowHeight
=
UITableView
.
automaticDimension
tableView
.
estimatedRowHeight
=
100
tableView
.
register
(
YHHomeCustomCell
.
self
,
forCellReuseIdentifier
:
YHHomeCustomCell
.
cellReuseIdentifier
)
//
tableView.rowHeight = UITableView.automaticDimension
//
tableView.estimatedRowHeight = 100
//
tableView.register(YHHomeCustomCell.self, forCellReuseIdentifier: YHHomeCustomCell.cellReuseIdentifier)
tableView
.
register
(
YHDavidCell0
.
self
,
forCellReuseIdentifier
:
YHDavidCell0
.
cellReuseIdentifier
)
tableView
.
register
(
YHDavidCell1
.
self
,
forCellReuseIdentifier
:
YHDavidCell1
.
cellReuseIdentifier
)
...
...
@@ -124,16 +124,15 @@ class YHHomeViewController: YHBaseViewController {
// MARK: - 生命周期方法
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
leaveTopOp
)
,
name
:
Notification
.
Name
(
rawValue
:
"leaveTop"
),
object
:
nil
)
// NotificationCenter.default.addObserver(self, selector: #selector(beginDragging), name:Notification.Name(rawValue: "scrollViewWillBeginDragging"), object: nil)
//
//
// NotificationCenter.default.addObserver(self, selector: #selector(endDragging), name:Notification.Name(rawValue: "scrollViewDidEndDragging"), object: nil)
// cellView.myParentVC = self
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
beginDragging
)
,
name
:
Notification
.
Name
(
rawValue
:
"scrollViewWillBeginDragging"
),
object
:
nil
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
endDragging
)
,
name
:
Notification
.
Name
(
rawValue
:
"scrollViewDidEndDragging"
),
object
:
nil
)
//1.UI
initView
()
...
...
@@ -152,22 +151,17 @@ class YHHomeViewController: YHBaseViewController {
extension
YHHomeViewController
{
@objc
func
leaveTopOp
()
{
print
(
"leaveTopOp"
)
canScroll
=
true
}
@objc
func
beginDragging
()
{
print
(
"beginDragging"
)
homeTableView
.
isScrollEnabled
=
false
canScroll
=
false
cellView
.
canScroll
=
false
}
@objc
func
endDragging
()
{
print
(
"endDragging"
)
homeTableView
.
isScrollEnabled
=
true
canScroll
=
true
cellView
.
canScroll
=
true
}
...
...
@@ -209,7 +203,7 @@ extension YHHomeViewController {
homeTableView
.
dataSource
=
self
view
.
addSubview
(
homeTableView
)
homeTableView
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
homeNavBarView
.
snp
.
bottom
)
.
offset
(
5
)
make
.
top
.
equalTo
(
homeNavBarView
.
snp
.
bottom
)
.
offset
(
0
)
make
.
left
.
right
.
bottom
.
equalToSuperview
()
}
...
...
@@ -341,7 +335,7 @@ extension YHHomeViewController : UITableViewDelegate,UITableViewDataSource {
let
cell
=
UITableViewCell
()
cellView
.
view
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
cell
.
contentView
.
bounds
.
size
.
width
,
height
:
KScreenHeight
-
64
)
cellView
.
view
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
cell
.
contentView
.
bounds
.
size
.
width
,
height
:
myCellHeight
)
cell
.
contentView
.
addSubview
(
cellView
.
view
)
return
cell
}
...
...
@@ -366,6 +360,11 @@ extension YHHomeViewController: UIScrollViewDelegate {
func
scrollViewDidScroll
(
_
scrollView
:
UIScrollView
)
{
// if scrollView.isScrollEnabled == false {
// printLog("Main scrollView.isScrollEnabled == false")
// return
// }
if
scrollView
===
homeTableView
{
let
bottomCellOffset
:
CGFloat
=
homeTableView
.
rect
(
forSection
:
1
)
.
origin
.
y
-
64
+
80
-
12
//48
printLog
(
"Main scrollView.contentOffset.y =
\(
scrollView
.
contentOffset
.
y
)
bottomCellOffset=
\(
bottomCellOffset
)
"
)
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHBbxCollectionViewCell.swift
View file @
44205b7a
...
...
@@ -49,7 +49,6 @@ class YHBbxCollectionViewCell: UICollectionViewCell {
private
func
setupUI
()
{
// contentView.backgroundColor = .brown //for test hjl
contentView
.
addSubview
(
titleImageView
)
titleImageView
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalToSuperview
()
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHDavidCell5.swift
View file @
44205b7a
...
...
@@ -109,10 +109,7 @@ class YHDavidCell5: UITableViewCell {
collectinoView
.
alwaysBounceVertical
=
true
myCollectView
=
collectinoView
myCollectView
.
isScrollEnabled
=
false
// myCollectView.backgroundColor = .red //for test hjl
// myCollectView.backgroundColor = UIColor(hex:0xff0000)
subContentView
.
addSubview
(
myCollectView
)
myCollectView
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
bbxLable
.
snp
.
bottom
)
.
offset
(
15
)
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHHomeCustomCell.swift
View file @
44205b7a
...
...
@@ -42,8 +42,6 @@ class YHHomeCustomCell: UITableViewCell {
collectionView
.
backgroundColor
=
UIColor
.
white
collectionView
.
register
(
YHAboutUsAdvantageCell
.
self
,
forCellWithReuseIdentifier
:
YHAboutUsAdvantageCell
.
cellReuseIdentifier
)
collectionView
.
delegate
=
self
collectionView
.
dataSource
=
self
collectionView
.
backgroundColor
=
.
yellow
//for test hjl
collectionContainer
=
UIView
(
frame
:
.
zero
)
...
...
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