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
b45d62a9
Commit
b45d62a9
authored
Apr 12, 2024
by
David黄金龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页 指示器
parent
3cbfa210
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
216 additions
and
41 deletions
+216
-41
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+8
-0
YHHomeBannerCollectionViewCell.swift
...s/Modules/Home(首页)/V/YHHomeBannerCollectionViewCell.swift
+83
-0
YHHomeBannerIndicatorView.swift
...lasses/Modules/Home(首页)/V/YHHomeBannerIndicatorView.swift
+110
-0
YHHomeBannerView.swift
.../galaxy/Classes/Modules/Home(首页)/V/YHHomeBannerView.swift
+15
-41
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
b45d62a9
...
...
@@ -288,6 +288,8 @@
6203A87EDC96313BBE789D9C
/* Pods_galaxy.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
987C69D43AE8D85DC1930DCF
/* Pods_galaxy.framework */
;
};
A501BE662BC2B76200C4F1FB
/* YHHomeHeadView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A501BE652BC2B76200C4F1FB
/* YHHomeHeadView.swift */
;
};
A501BE682BC2B85F00C4F1FB
/* YHHomeSearchView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A501BE672BC2B85F00C4F1FB
/* YHHomeSearchView.swift */
;
};
A50A747C2BC8EC86003D28D9
/* YHHomeBannerCollectionViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A50A747B2BC8EC86003D28D9
/* YHHomeBannerCollectionViewCell.swift */
;
};
A50A747E2BC91308003D28D9
/* YHHomeBannerIndicatorView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A50A747D2BC91308003D28D9
/* YHHomeBannerIndicatorView.swift */
;
};
A51044182B493675006B60BB
/* README.md in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A51044172B493675006B60BB
/* README.md */
;
};
A510441A2B495DD0006B60BB
/* UIView+Extension.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A51044192B495DD0006B60BB
/* UIView+Extension.swift */
;
};
A514E5DC2B60A2B700C93951
/* YHServiceCenterSecondViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A514E5DB2B60A2B700C93951
/* YHServiceCenterSecondViewController.swift */
;
};
...
...
@@ -729,6 +731,8 @@
987C69D43AE8D85DC1930DCF
/* Pods_galaxy.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
includeInIndex
=
0
;
path
=
Pods_galaxy.framework
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
A501BE652BC2B76200C4F1FB
/* YHHomeHeadView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHHomeHeadView.swift
;
sourceTree
=
"<group>"
;
};
A501BE672BC2B85F00C4F1FB
/* YHHomeSearchView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHHomeSearchView.swift
;
sourceTree
=
"<group>"
;
};
A50A747B2BC8EC86003D28D9
/* YHHomeBannerCollectionViewCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHHomeBannerCollectionViewCell.swift
;
sourceTree
=
"<group>"
;
};
A50A747D2BC91308003D28D9
/* YHHomeBannerIndicatorView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHHomeBannerIndicatorView.swift
;
sourceTree
=
"<group>"
;
};
A51044172B493675006B60BB
/* README.md */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
net.daringfireball.markdown
;
path
=
README.md
;
sourceTree
=
"<group>"
;
};
A51044192B495DD0006B60BB
/* UIView+Extension.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"UIView+Extension.swift"
;
sourceTree
=
"<group>"
;
};
A514E5DB2B60A2B700C93951
/* YHServiceCenterSecondViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHServiceCenterSecondViewController.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -2195,6 +2199,8 @@
A5173D6B2BC3C273007D4E74
/* YHHomeKingKongBlockView.swift */
,
A5F9AD322BC3CD66000323F8
/* YHHkLifeAndIdItemView.swift */
,
A53F42BA2BC3DE6F009CAC70
/* YHHomeKingKongBlockItem.swift */
,
A50A747B2BC8EC86003D28D9
/* YHHomeBannerCollectionViewCell.swift */
,
A50A747D2BC91308003D28D9
/* YHHomeBannerIndicatorView.swift */
,
);
path
=
V
;
sourceTree
=
"<group>"
;
...
...
@@ -2622,6 +2628,7 @@
04754A952B96FF3D00F8ADCA
/* UITextField+Extension.swift in Sources */
,
A5ACE9312B4564F7002C94D2
/* YHPersonalCenterCell.swift in Sources */
,
045EEE9A2B9F171A0022A143
/* YHWorkIntroductionViewModel.swift in Sources */
,
A50A747E2BC91308003D28D9
/* YHHomeBannerIndicatorView.swift in Sources */
,
A5ACE9532B4564F7002C94D2
/* YHBaseViewController.swift in Sources */
,
045EEE9D2B9F171A0022A143
/* YHWorkItemListViewModel.swift in Sources */
,
A5ACE9392B4564F7002C94D2
/* UIDevice+Extension.swift in Sources */
,
...
...
@@ -2764,6 +2771,7 @@
045EEEF92B9F171A0022A143
/* YHFormItemTitleCell.swift in Sources */
,
A580371E2BAD784B0031C312
/* YHMySchemeViewModel.swift in Sources */
,
0425E6482BA96B4100A5E763
/* YHSchemeHeadScoreItemView.swift in Sources */
,
A50A747C2BC8EC86003D28D9
/* YHHomeBannerCollectionViewCell.swift in Sources */
,
A501BE662BC2B76200C4F1FB
/* YHHomeHeadView.swift in Sources */
,
04A271252BAC33BB00652B1B
/* YHFilePreviewTool.swift in Sources */
,
044413F92BC279D200784A14
/* YHHomeWebBottomView.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHHomeBannerCollectionViewCell.swift
0 → 100644
View file @
b45d62a9
//
// YHHomeBannerCollectionViewCell.swift
// galaxy
//
// Created by davidhuangA on 2024/4/12.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
import
FSPagerView
class
YHHomeBannerCollectionViewCell
:
FSPagerViewCell
{
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
textLabel
?
.
text
=
""
textLabel
?
.
isHidden
=
true
imageView
?
.
isHidden
=
true
initView
()
}
required
init
?(
coder
aDecoder
:
NSCoder
)
{
fatalError
(
"init(coder:) has not been implemented"
)
}
lazy
var
bannerImagV
:
UIImageView
=
{
let
imagV
:
UIImageView
=
UIImageView
()
imagV
.
contentMode
=
.
scaleAspectFill
imagV
.
clipsToBounds
=
true
return
imagV
}()
lazy
var
bannerTitleLable
:
UILabel
=
{
let
lable
=
UILabel
()
lable
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
16
)
lable
.
textColor
=
UIColor
.
white
return
lable
}()
lazy
var
effectV
:
UIVisualEffectView
=
{
let
effect
=
UIBlurEffect
(
style
:
.
light
)
let
effectV
=
UIVisualEffectView
.
init
(
effect
:
effect
)
return
effectV
}()
var
dataModel
:
YHBannerModel
?
{
didSet
{
updateUI
()
}
}
}
private
extension
YHHomeBannerCollectionViewCell
{
func
initView
()
{
contentView
.
addSubview
(
bannerImagV
)
bannerImagV
.
snp
.
makeConstraints
{
make
in
make
.
edges
.
equalToSuperview
()
}
contentView
.
addSubview
(
effectV
)
effectV
.
snp
.
makeConstraints
{
make
in
make
.
bottom
.
left
.
right
.
equalToSuperview
()
make
.
height
.
equalTo
(
77
)
}
contentView
.
addSubview
(
bannerTitleLable
)
bannerTitleLable
.
snp
.
makeConstraints
{
make
in
make
.
right
.
equalTo
(
-
20
)
make
.
bottom
.
equalTo
(
-
35
)
make
.
left
.
equalTo
(
20
)
make
.
height
.
equalTo
(
22
)
}
}
func
updateUI
()
{
guard
let
model
=
dataModel
else
{
return
}
if
let
url
=
URL
(
string
:
model
.
img_url
)
{
bannerImagV
.
kf
.
setImage
(
with
:
url
)
}
bannerTitleLable
.
text
=
model
.
name
}
}
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHHomeBannerIndicatorView.swift
0 → 100644
View file @
b45d62a9
//
// YHHomeBannerIndicatorView.swift
// galaxy
//
// Created by davidhuangA on 2024/4/12.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHHomeBannerIndicatorView
:
UIView
{
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
initView
()
}
required
init
?(
coder
:
NSCoder
)
{
fatalError
(
"init(coder:) has not been implemented"
)
}
var
indicatorItems
:
Int
=
0
{
didSet
{
createUI
()
}
}
var
curIndicatorIndex
:
Int
=
0
{
didSet
{
updateUI
()
}
}
private
var
arrViews
:
[
UIView
]
=
[]
private
var
normalColor
:
UIColor
=
UIColor
(
hex
:
0xffffff
,
alpha
:
0.3
)
private
var
selectedColor
:
UIColor
=
UIColor
(
hex
:
0xffffff
)
lazy
var
subHoldView
:
UIView
=
{
let
view
=
UIView
()
return
view
}()
}
extension
YHHomeBannerIndicatorView
{
func
initView
()
{
addSubview
(
subHoldView
)
subHoldView
.
snp
.
makeConstraints
{
make
in
make
.
centerX
.
centerY
.
equalToSuperview
()
make
.
top
.
bottom
.
equalToSuperview
()
}
}
func
createUI
()
{
arrViews
.
removeAll
()
subHoldView
.
removeSubviews
()
if
indicatorItems
==
1
{
let
view
=
UIView
()
view
.
backgroundColor
=
normalColor
subHoldView
.
addSubview
(
view
)
view
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalToSuperview
()
make
.
right
.
equalToSuperview
()
make
.
top
.
bottom
.
equalToSuperview
()
make
.
width
.
equalTo
(
16
)
}
}
else
{
var
tagView
:
UIView
?
for
i
in
0
..<
indicatorItems
{
let
view
=
UIView
()
view
.
backgroundColor
=
normalColor
subHoldView
.
addSubview
(
view
)
if
i
==
0
{
view
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalToSuperview
()
make
.
top
.
bottom
.
equalToSuperview
()
make
.
width
.
equalTo
(
16
)
}
}
else
if
i
==
indicatorItems
-
1
{
view
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
tagView
!.
snp
.
right
)
.
offset
(
3
)
make
.
right
.
equalToSuperview
()
make
.
top
.
bottom
.
equalToSuperview
()
make
.
width
.
equalTo
(
16
)
}
}
else
{
view
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
tagView
!.
snp
.
right
)
.
offset
(
3
)
make
.
top
.
bottom
.
equalToSuperview
()
make
.
width
.
equalTo
(
16
)
}
}
tagView
=
view
arrViews
.
append
(
view
)
}
}
}
func
updateUI
()
{
if
curIndicatorIndex
<
indicatorItems
{
for
(
index
,
item
)
in
arrViews
.
enumerated
()
{
if
index
==
curIndicatorIndex
{
item
.
backgroundColor
=
selectedColor
}
else
{
item
.
backgroundColor
=
normalColor
}
}
}
}
}
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHHomeBannerView.swift
View file @
b45d62a9
...
...
@@ -11,10 +11,10 @@ import FSPagerView
import
Kingfisher
class
YHHomeBannerView
:
UIView
{
static
let
viewH
:
CGFloat
=
KScreenWidth
-
20
*
2
static
let
viewH
:
CGFloat
=
KScreenWidth
-
20
.0
*
2
var
dataArr
:
[
YHBannerModel
]
=
[]
{
didSet
{
self
.
pageControl
.
numberOfPage
s
=
self
.
dataArr
.
count
self
.
indicatorView
.
indicatorItem
s
=
self
.
dataArr
.
count
bannerView
.
reloadData
()
}
}
...
...
@@ -33,16 +33,15 @@ class YHHomeBannerView: UIView {
view
.
delegate
=
self
view
.
dataSource
=
self
view
.
automaticSlidingInterval
=
4
view
.
register
(
FSPager
ViewCell
.
self
,
forCellWithReuseIdentifier
:
"cell"
)
view
.
itemSize
=
FSPagerView
.
automaticSize
view
.
register
(
YHHomeBannerCollection
ViewCell
.
self
,
forCellWithReuseIdentifier
:
"cell"
)
view
.
itemSize
=
CGSizeMake
(
YHHomeBannerView
.
viewH
,
YHHomeBannerView
.
viewH
)
//
FSPagerView.automaticSize
return
view
}()
lazy
var
pageControl
:
FSPageControl
=
{
let
view
=
FSPageControl
()
lazy
var
indicatorView
:
YHHomeBannerIndicatorView
=
{
let
view
=
YHHomeBannerIndicatorView
()
return
view
}()
}
private
extension
YHHomeBannerView
{
...
...
@@ -55,29 +54,15 @@ private extension YHHomeBannerView {
make
.
height
.
equalTo
(
YHHomeBannerView
.
viewH
)
}
bannerView
.
addSubview
(
pageControl
)
pageControl
.
snp
.
makeConstraints
{
make
in
make
.
left
.
bottom
.
right
.
equalToSuperview
()
make
.
height
.
equalTo
(
16.5
)
bannerView
.
addSubview
(
indicatorView
)
indicatorView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
equalToSuperview
()
make
.
height
.
equalTo
(
2
)
make
.
bottom
.
equalTo
(
-
14
)
}
setupPageControl
()
bannerView
.
reloadData
()
}
func
setupPageControl
()
{
self
.
pageControl
.
numberOfPages
=
self
.
dataArr
.
count
self
.
pageControl
.
contentHorizontalAlignment
=
.
center
self
.
pageControl
.
contentInsets
=
UIEdgeInsets
(
top
:
0
,
left
:
12
,
bottom
:
10
,
right
:
12
)
let
normalImage
=
UIImage
(
color
:
UIColor
(
hex
:
0xff0000
,
alpha
:
1.0
),
size
:
CGSize
(
width
:
5
,
height
:
5
))
let
selectImage
=
UIImage
(
color
:
.
white
,
size
:
CGSize
(
width
:
8
,
height
:
5
))
self
.
pageControl
.
setImage
(
normalImage
,
for
:
.
normal
)
self
.
pageControl
.
setImage
(
selectImage
,
for
:
.
selected
)
self
.
pageControl
.
interitemSpacing
=
3
}
func
goAppTab
(
tabBarName
:
String
)
{
if
!
tabBarName
.
isEmpty
{
if
tabBarName
.
contains
(
"tabBarHome"
,
caseSensitive
:
false
)
{
...
...
@@ -92,7 +77,6 @@ private extension YHHomeBannerView {
}
else
if
tabBarName
.
contains
(
"tabBarMine"
,
caseSensitive
:
false
)
{
//我的
goTabBarBy
(
tabType
:
.
mine
)
}
else
{
}
...
...
@@ -107,20 +91,10 @@ extension YHHomeBannerView: FSPagerViewDataSource, FSPagerViewDelegate {
}
public
func
pagerView
(
_
pagerView
:
FSPagerView
,
cellForItemAt
index
:
Int
)
->
FSPagerViewCell
{
let
cell
=
pagerView
.
dequeueReusableCell
(
withReuseIdentifier
:
"cell"
,
at
:
index
)
let
image
=
UIImage
(
named
:
"default_placeholder_image"
)
cell
.
imageView
?
.
image
=
image
let
cell
=
pagerView
.
dequeueReusableCell
(
withReuseIdentifier
:
"cell"
,
at
:
index
)
as!
YHHomeBannerCollectionViewCell
if
index
<
dataArr
.
count
{
let
model
=
dataArr
[
index
]
if
let
url
=
URL
(
string
:
model
.
img_url
)
{
cell
.
imageView
?
.
kf
.
setImage
(
with
:
url
)
}
cell
.
textLabel
?
.
text
=
model
.
name
cell
.
dataModel
=
dataArr
[
index
]
}
cell
.
imageView
?
.
contentMode
=
.
scaleAspectFill
cell
.
backgroundColor
=
.
contentBkgColor
cell
.
contentView
.
layer
.
shadowColor
=
UIColor
.
clear
.
cgColor
return
cell
}
...
...
@@ -156,10 +130,10 @@ extension YHHomeBannerView: FSPagerViewDataSource, FSPagerViewDelegate {
}
func
pagerViewWillEndDragging
(
_
pagerView
:
FSPagerView
,
targetIndex
:
Int
)
{
self
.
pageControl
.
currentPage
=
targetIndex
self
.
indicatorView
.
curIndicatorIndex
=
targetIndex
}
func
pagerViewDidEndScrollAnimation
(
_
pagerView
:
FSPagerView
)
{
self
.
pageControl
.
currentPage
=
pagerView
.
currentIndex
self
.
indicatorView
.
curIndicatorIndex
=
pagerView
.
currentIndex
}
}
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