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
f301fa55
Commit
f301fa55
authored
Apr 01, 2025
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// plan
parent
d29e230c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
7 deletions
+44
-7
YHPlanPolicyDetailViewController.swift
...Modules/Plan(方案)/C/YHPlanPolicyDetailViewController.swift
+44
-7
No files found.
galaxy/galaxy/Classes/Modules/Plan(方案)/C/YHPlanPolicyDetailViewController.swift
View file @
f301fa55
...
@@ -17,6 +17,7 @@ class YHPlanPolicyImageInfo {
...
@@ -17,6 +17,7 @@ class YHPlanPolicyImageInfo {
class
YHPlanPolicyDetailViewController
:
YHBaseViewController
{
class
YHPlanPolicyDetailViewController
:
YHBaseViewController
{
var
firstAppear
:
Bool
=
true
var
arr
:
[
YHPlanCaseModel
]
=
[]
{
var
arr
:
[
YHPlanCaseModel
]
=
[]
{
didSet
{
didSet
{
imgs
.
removeAll
()
imgs
.
removeAll
()
...
@@ -25,6 +26,7 @@ class YHPlanPolicyDetailViewController: YHBaseViewController {
...
@@ -25,6 +26,7 @@ class YHPlanPolicyDetailViewController: YHBaseViewController {
model
.
model
=
item
model
.
model
=
item
imgs
.
append
(
model
)
imgs
.
append
(
model
)
}
}
self
.
collectionView
.
reloadData
()
}
}
}
}
...
@@ -32,17 +34,18 @@ class YHPlanPolicyDetailViewController: YHBaseViewController {
...
@@ -32,17 +34,18 @@ class YHPlanPolicyDetailViewController: YHBaseViewController {
var
imgs
:
[
YHPlanPolicyImageInfo
]
=
[]
var
imgs
:
[
YHPlanPolicyImageInfo
]
=
[]
// lazy var scrollView: UIScrollView = {
lazy
var
bgImgView
:
UIImageView
=
{
// let v = UIScrollView(frame: .zero)
let
v
=
UIImageView
()
// return v
v
.
clipsToBounds
=
true
// }()
return
v
}()
lazy
var
collectionView
:
UICollectionView
=
{
lazy
var
collectionView
:
UICollectionView
=
{
let
layout
=
UICollectionViewFlowLayout
()
let
layout
=
UICollectionViewFlowLayout
()
layout
.
minimumInteritemSpacing
=
0.0
layout
.
minimumInteritemSpacing
=
0.0
layout
.
minimumLineSpacing
=
0.0
layout
.
minimumLineSpacing
=
0.0
layout
.
scrollDirection
=
.
horizontal
layout
.
scrollDirection
=
.
horizontal
let
collectView
=
UICollectionView
(
frame
:
.
zero
,
collectionViewLayout
:
layout
)
let
collectView
=
UICollectionView
(
frame
:
CGRect
(
x
:
0
,
y
:
k_Height_NavigationtBarAndStatuBar
+
24.0
,
width
:
KScreenWidth
,
height
:
520
)
,
collectionViewLayout
:
layout
)
collectView
.
backgroundColor
=
.
clear
collectView
.
backgroundColor
=
.
clear
collectView
.
delegate
=
self
collectView
.
delegate
=
self
collectView
.
dataSource
=
self
collectView
.
dataSource
=
self
...
@@ -51,6 +54,12 @@ class YHPlanPolicyDetailViewController: YHBaseViewController {
...
@@ -51,6 +54,12 @@ class YHPlanPolicyDetailViewController: YHBaseViewController {
return
collectView
return
collectView
}()
}()
lazy
var
blurView
:
UIVisualEffectView
=
{
let
blurEffect
=
UIBlurEffect
(
style
:
.
light
)
// 可以选择不同的模糊样式
let
blurEffectView
=
UIVisualEffectView
(
effect
:
blurEffect
)
return
blurEffectView
}()
lazy
var
shareBtn
:
UIButton
=
{
lazy
var
shareBtn
:
UIButton
=
{
let
btn
=
UIButton
()
let
btn
=
UIButton
()
btn
.
backgroundColor
=
.
white
btn
.
backgroundColor
=
.
white
...
@@ -69,9 +78,18 @@ class YHPlanPolicyDetailViewController: YHBaseViewController {
...
@@ -69,9 +78,18 @@ class YHPlanPolicyDetailViewController: YHBaseViewController {
gk_navTitle
=
"
\(
currentIndex
+
1
)
/
\(
arr
.
count
)
"
gk_navTitle
=
"
\(
currentIndex
+
1
)
/
\(
arr
.
count
)
"
gk_navTitleColor
=
.
white
gk_navTitleColor
=
.
white
view
.
backgroundColor
=
.
init
(
hex
:
0x000000
,
alpha
:
1.0
)
view
.
backgroundColor
=
.
init
(
hex
:
0x000000
,
alpha
:
1.0
)
view
.
addSubview
(
bgImgView
)
view
.
addSubview
(
blurView
)
view
.
addSubview
(
collectionView
)
view
.
addSubview
(
collectionView
)
view
.
addSubview
(
shareBtn
)
view
.
addSubview
(
shareBtn
)
bgImgView
.
snp
.
makeConstraints
{
make
in
make
.
edges
.
equalToSuperview
()
}
blurView
.
snp
.
makeConstraints
{
make
in
make
.
edges
.
equalToSuperview
()
}
collectionView
.
snp
.
makeConstraints
{
make
in
collectionView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
equalToSuperview
()
make
.
left
.
right
.
equalToSuperview
()
make
.
top
.
equalTo
(
k_Height_NavigationtBarAndStatuBar
+
24.0
)
make
.
top
.
equalTo
(
k_Height_NavigationtBarAndStatuBar
+
24.0
)
...
@@ -84,8 +102,26 @@ class YHPlanPolicyDetailViewController: YHBaseViewController {
...
@@ -84,8 +102,26 @@ class YHPlanPolicyDetailViewController: YHBaseViewController {
make
.
height
.
equalTo
(
46
)
make
.
height
.
equalTo
(
46
)
make
.
top
.
equalTo
(
collectionView
.
snp
.
bottom
)
.
offset
(
32
)
make
.
top
.
equalTo
(
collectionView
.
snp
.
bottom
)
.
offset
(
32
)
}
}
collectionView
.
setContentOffset
(
CGPoint
(
x
:
KScreenWidth
*
Double
(
currentIndex
),
y
:
0.0
),
animated
:
true
)
loadImgs
()
loadImgs
()
showBgImage
(
index
:
currentIndex
)
}
func
showBgImage
(
index
:
Int
)
{
if
0
<=
index
,
index
<
arr
.
count
{
let
model
=
arr
[
index
]
if
let
url
=
URL
(
string
:
model
.
img_url
)
{
bgImgView
.
kf
.
setImage
(
with
:
url
)
}
}
}
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
if
firstAppear
{
collectionView
.
scrollToItem
(
at
:
IndexPath
(
row
:
currentIndex
,
section
:
0
),
at
:
.
top
,
animated
:
false
)
firstAppear
=
false
}
}
}
func
loadImgs
()
{
func
loadImgs
()
{
...
@@ -123,7 +159,7 @@ extension YHPlanPolicyDetailViewController: UICollectionViewDelegate, UICollecti
...
@@ -123,7 +159,7 @@ extension YHPlanPolicyDetailViewController: UICollectionViewDelegate, UICollecti
// 返回每个单元格的大小
// 返回每个单元格的大小
func
collectionView
(
_
collectionView
:
UICollectionView
,
layout
collectionViewLayout
:
UICollectionViewLayout
,
sizeForItemAt
indexPath
:
IndexPath
)
->
CGSize
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
layout
collectionViewLayout
:
UICollectionViewLayout
,
sizeForItemAt
indexPath
:
IndexPath
)
->
CGSize
{
return
CGSize
(
width
:
KScreenWidth
,
height
:
collectionView
.
height
)
return
CGSize
(
width
:
KScreenWidth
,
height
:
520
)
}
}
// 返回自定义单元格
// 返回自定义单元格
...
@@ -150,6 +186,7 @@ extension YHPlanPolicyDetailViewController: UIScrollViewDelegate {
...
@@ -150,6 +186,7 @@ extension YHPlanPolicyDetailViewController: UIScrollViewDelegate {
func
scrollViewDidScroll
(
_
scrollView
:
UIScrollView
)
{
func
scrollViewDidScroll
(
_
scrollView
:
UIScrollView
)
{
let
currentIndex
=
Int
(
scrollView
.
contentOffset
.
x
/
KScreenWidth
)
let
currentIndex
=
Int
(
scrollView
.
contentOffset
.
x
/
KScreenWidth
)
gk_navTitle
=
"
\(
currentIndex
+
1
)
/
\(
arr
.
count
)
"
gk_navTitle
=
"
\(
currentIndex
+
1
)
/
\(
arr
.
count
)
"
showBgImage
(
index
:
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