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
62b6b104
Commit
62b6b104
authored
Apr 11, 2025
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定位相关问题
parent
729fbeb0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
7 deletions
+20
-7
YHMakePlanViewController.swift
...odules/Plan(方案)/MakePlan/C/YHMakePlanViewController.swift
+20
-7
No files found.
galaxy/galaxy/Classes/Modules/Plan(方案)/MakePlan/C/YHMakePlanViewController.swift
View file @
62b6b104
...
...
@@ -15,8 +15,11 @@ class YHMakePlanViewController: YHBaseViewController {
lazy
var
headView
:
YHMakePlanHeadView
=
{
let
view
=
YHMakePlanHeadView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
KScreenWidth
,
height
:
333
.
fix
+
44
))
view
.
block
=
{
tag
in
self
.
tableView
.
scrollToRow
(
at
:
IndexPath
(
row
:
tag
,
section
:
0
),
at
:
.
top
,
animated
:
true
)
self
.
topView
.
custtomView
.
updataData
(
tag
)
let
indexPath
=
IndexPath
(
row
:
tag
,
section
:
0
)
let
cellRect
:
CGRect
=
self
.
tableView
.
rectForRow
(
at
:
indexPath
)
let
targetY
=
cellRect
.
origin
.
y
-
104
-
k_Height_NavigationtBarAndStatuBar
self
.
tableView
.
setContentOffset
(
CGPoint
(
x
:
0
,
y
:
targetY
),
animated
:
true
)
}
return
view
}()
...
...
@@ -46,8 +49,11 @@ class YHMakePlanViewController: YHBaseViewController {
let
view
=
YHMakePlanTopView
()
view
.
isHidden
=
true
view
.
block
=
{
tag
in
self
.
tableView
.
scrollToRow
(
at
:
IndexPath
(
row
:
tag
,
section
:
0
),
at
:
.
top
,
animated
:
true
)
self
.
headView
.
custtomView
.
updataData
(
tag
)
let
indexPath
=
IndexPath
(
row
:
tag
,
section
:
0
)
let
cellRect
:
CGRect
=
self
.
tableView
.
rectForRow
(
at
:
indexPath
)
let
targetY
=
cellRect
.
origin
.
y
-
104
-
k_Height_NavigationtBarAndStatuBar
self
.
tableView
.
setContentOffset
(
CGPoint
(
x
:
0
,
y
:
targetY
),
animated
:
true
)
}
return
view
}()
...
...
@@ -279,12 +285,19 @@ extension UITableView {
/// 获取当前显示在最顶部的行索引
func
topVisibleRowIndex
()
->
Int
?
{
// 获取所有可见行的indexPath(按从上到下的顺序排列)
guard
let
visibleIndexPaths
=
self
.
indexPathsForVisibleRows
?
.
sorted
()
else
{
return
nil
let
visibleRect
=
CGRect
(
x
:
self
.
contentOffset
.
x
,
y
:
self
.
contentOffset
.
y
+
104
+
k_Height_NavigationtBarAndStatuBar
,
// 向下偏移 187px
width
:
self
.
bounds
.
width
,
height
:
self
.
bounds
.
height
)
// 获取该区域内的所有行
guard
let
indexPaths
=
self
.
indexPathsForRows
(
in
:
visibleRect
)
else
{
return
0
}
// 第一个就是最顶部的行
return
visibleIndexPaths
.
first
?
.
row
return
indexPaths
.
first
?
.
row
}
/// 获取当前显示在最顶部的单元格
...
...
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