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
f6a6422b
Commit
f6a6422b
authored
May 05, 2021
by
Demid Merzlyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix moon cell layout on the iPad.
parent
710d5e60
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
8 deletions
+21
-8
1Weather/UI/SharedCells/MoonPhaseCell/MoonPhaseCell.swift
+21
-8
No files found.
1Weather/UI/SharedCells/MoonPhaseCell/MoonPhaseCell.swift
View file @
f6a6422b
...
...
@@ -9,7 +9,8 @@ import UIKit
class
MoonPhaseCell
:
UITableViewCell
{
//Private
private
let
kCircleInset
:
CGFloat
=
55
private
let
kCircleInsetX
:
CGFloat
=
55
private
let
kCircleInsetY
:
CGFloat
=
32
private
let
headingLabel
=
UILabel
()
private
let
headingButton
=
ArrowButton
()
private
let
container
=
UIView
()
...
...
@@ -54,14 +55,23 @@ class MoonPhaseCell: UITableViewCell {
fatalError
(
"init(coder:) has not been implemented"
)
}
var
pathCenter
:
CGPoint
{
CGPoint
(
x
:
baseLine
.
frame
.
origin
.
x
+
baseLine
.
bounds
.
width
/
2
,
y
:
baseLine
.
frame
.
origin
.
y
)
}
var
pathRadius
:
CGFloat
{
let
center
=
pathCenter
return
min
(
center
.
x
-
kCircleInsetX
,
center
.
y
-
kCircleInsetY
)
}
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
let
center
=
CGPoint
(
x
:
baseLine
.
frame
.
origin
.
x
+
baseLine
.
bounds
.
width
/
2
,
y
:
baseLine
.
frame
.
origin
.
y
)
let
radius
=
center
.
x
-
kCircleInset
let
center
=
pathCenter
let
radius
=
pathRadius
//Gradient
circleGradientLayer
.
frame
=
.
init
(
x
:
kCircleInset
-
4
,
circleGradientLayer
.
frame
=
.
init
(
x
:
center
.
x
-
radius
-
4
,
y
:
center
.
y
-
radius
-
4
,
width
:
(
radius
*
2
)
+
8
,
height
:
radius
+
4
)
...
...
@@ -99,8 +109,8 @@ class MoonPhaseCell: UITableViewCell {
let
start
:
CGFloat
=
-.
pi
let
end
:
CGFloat
=
0
let
percent
=
(
start
-
end
)
*
pathProgress
let
center
=
CGPoint
(
x
:
baseLine
.
frame
.
origin
.
x
+
baseLine
.
bounds
.
width
/
2
,
y
:
baseLine
.
frame
.
origin
.
y
)
let
radius
=
center
.
x
-
kCircleInset
let
center
=
pathCenter
let
radius
=
pathRadius
let
path
=
UIBezierPath
(
arcCenter
:
center
,
radius
:
radius
,
...
...
@@ -163,9 +173,12 @@ class MoonPhaseCell: UITableViewCell {
public
func
updateMoonPosition
()
{
contentView
.
layoutIfNeeded
()
let
center
=
pathCenter
let
radius
=
pathRadius
moonImageView
.
layer
.
removeAnimation
(
forKey
:
"moon.position"
)
moonImageView
.
frame
.
origin
=
.
init
(
x
:
kCircleInset
-
moonImageView
.
frame
.
width
/
2
,
y
:
baseLine
.
frame
.
origin
.
y
-
moonImageView
.
frame
.
height
)
moonImageView
.
frame
.
origin
=
.
init
(
x
:
center
.
x
-
radius
-
moonImageView
.
frame
.
width
/
2
,
y
:
center
.
y
-
moonImageView
.
frame
.
height
)
let
animation
=
CAKeyframeAnimation
(
keyPath
:
"position"
)
animation
.
path
=
self
.
moonPath
(
progress
:
moonProgress
)
.
cgPath
...
...
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