Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
1
1weather
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
1weather
Commits
1b2c820b
Commit
1b2c820b
authored
Nov 16, 2020
by
Dmitriy Stepanets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finished scroll indicator
parent
ac9ecdf7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
1Weather.xcworkspace/xcuserdata/dstepanets.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
1Weather/Cells/CurrentForecastDetailsCell.swift
+20
-3
No files found.
1Weather.xcworkspace/xcuserdata/dstepanets.xcuserdatad/UserInterfaceState.xcuserstate
View file @
1b2c820b
No preview for this file type
1Weather/Cells/CurrentForecastDetailsCell.swift
View file @
1b2c820b
...
...
@@ -6,6 +6,7 @@
//
import
UIKit
import
SnapKit
private
class
InfoCardView
:
UIView
{
private
let
valueLabel
=
UILabel
()
...
...
@@ -58,6 +59,9 @@ class CurrentForecastDetailsCell: UITableViewCell {
private
let
stackView
=
UIStackView
()
private
let
progressView
=
UIView
()
private
let
progressIndicator
=
UIView
()
private
let
kIndicatorWidth
:
CGFloat
=
16
private
var
indicatorWidthConstraint
:
Constraint
?
private
var
indicatorLeftConstraint
:
Constraint
?
override
init
(
style
:
UITableViewCell
.
CellStyle
,
reuseIdentifier
:
String
?)
{
super
.
init
(
style
:
style
,
reuseIdentifier
:
reuseIdentifier
)
...
...
@@ -98,6 +102,7 @@ private extension CurrentForecastDetailsCell {
scrollView
.
contentInset
=
.
init
(
top
:
0
,
left
:
16
,
bottom
:
0
,
right
:
16
)
scrollView
.
showsVerticalScrollIndicator
=
false
scrollView
.
showsHorizontalScrollIndicator
=
false
scrollView
.
delegate
=
self
contentView
.
addSubview
(
scrollView
)
scrollView
.
snp
.
makeConstraints
{
(
make
)
in
...
...
@@ -182,11 +187,23 @@ private extension CurrentForecastDetailsCell {
progressIndicator
.
layer
.
cornerRadius
=
2
progressIndicator
.
clipsToBounds
=
true
progressView
.
addSubview
(
progressIndicator
)
progressIndicator
.
snp
.
makeConstraints
{
(
make
)
in
progressIndicator
.
snp
.
makeConstraints
{
[
weak
self
]
(
make
)
in
make
.
height
.
equalToSuperview
()
make
.
left
.
equalToSuperview
()
self
?
.
indicatorLeftConstraint
=
make
.
left
.
equalToSuperview
()
.
constraint
make
.
centerY
.
equalToSuperview
()
make
.
width
.
equalTo
(
16
)
self
?
.
indicatorWidthConstraint
=
make
.
width
.
equalTo
(
kIndicatorWidth
)
.
constraint
}
}
}
//MARK:- UIScrollView Delegate
extension
CurrentForecastDetailsCell
:
UIScrollViewDelegate
{
func
scrollViewDidScroll
(
_
scrollView
:
UIScrollView
)
{
let
totalContentWidth
=
scrollView
.
contentSize
.
width
+
scrollView
.
contentInset
.
left
+
scrollView
.
contentInset
.
right
let
scrollProgress
=
(
scrollView
.
contentOffset
.
x
+
scrollView
.
contentInset
.
left
)
/
(
totalContentWidth
-
scrollView
.
bounds
.
width
)
let
multiplier
=
(
progressView
.
bounds
.
width
-
kIndicatorWidth
)
/
kIndicatorWidth
indicatorLeftConstraint
?
.
layoutConstraints
.
first
?
.
constant
=
multiplier
*
scrollProgress
*
kIndicatorWidth
}
}
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