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
e5a7196d
Commit
e5a7196d
authored
May 01, 2021
by
Demid Merzlyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Today Conditions Cells layout changed to center vertically.
parent
9d247a4e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
19 deletions
+36
-19
1Weather/UI/View controllers/Today/Cells/TodayConditions/TodayConditionButton.swift
+32
-18
1Weather/UI/View controllers/Today/Cells/TodayConditions/TodayConditionsCell.swift
+4
-1
No files found.
1Weather/UI/View controllers/Today/Cells/TodayConditions/TodayConditionButton.swift
View file @
e5a7196d
...
...
@@ -14,13 +14,15 @@ class TodayConditionButton: UIControl {
private
let
valueLabel
=
UILabel
()
private
let
nameLabel
=
UILabel
()
private
let
descriptionLabel
=
UILabel
()
private
let
containerView
=
UIView
()
init
(
type
:
WeatherConditionType
)
{
self
.
conditionType
=
type
super
.
init
(
frame
:
.
zero
)
prepareSelf
()
prepareButton
()
prepareSelf
()
prepareContainer
()
prepareImageView
()
prepareLabels
()
}
...
...
@@ -60,7 +62,16 @@ class TodayConditionButton: UIControl {
private
extension
TodayConditionButton
{
func
prepareSelf
()
{
snp
.
makeConstraints
{
(
make
)
in
make
.
width
.
equalTo
(
200
)
make
.
width
.
equalTo
(
180
)
}
}
func
prepareContainer
()
{
containerView
.
backgroundColor
=
.
clear
addSubview
(
containerView
)
containerView
.
snp
.
makeConstraints
{
(
make
)
in
make
.
centerY
.
equalToSuperview
()
make
.
left
.
equalToSuperview
()
}
}
...
...
@@ -82,7 +93,7 @@ private extension TodayConditionButton {
imageView
.
contentMode
=
.
scaleAspectFit
imageView
.
clipsToBounds
=
true
imageView
.
image
=
conditionType
.
image
addSubview
(
imageView
)
containerView
.
addSubview
(
imageView
)
imageView
.
snp
.
makeConstraints
{
(
make
)
in
make
.
left
.
top
.
equalToSuperview
()
.
inset
(
20
)
...
...
@@ -97,10 +108,11 @@ private extension TodayConditionButton {
valueLabel
.
textColor
=
ThemeManager
.
currentTheme
.
secondaryTextColor
valueLabel
.
textAlignment
=
.
left
valueLabel
.
text
=
"21%"
addSubview
(
valueLabel
)
containerView
.
addSubview
(
valueLabel
)
valueLabel
.
snp
.
makeConstraints
{
(
make
)
in
make
.
left
.
equalTo
(
imageView
.
snp
.
right
)
.
offset
(
13
)
make
.
right
.
lessThanOrEqualToSuperview
()
.
inset
(
20
)
make
.
top
.
equalToSuperview
()
.
inset
(
16
)
}
...
...
@@ -110,24 +122,26 @@ private extension TodayConditionButton {
nameLabel
.
textColor
=
ThemeManager
.
currentTheme
.
secondaryTextColor
nameLabel
.
textAlignment
=
.
left
nameLabel
.
text
=
conditionType
.
localized
addSubview
(
nameLabel
)
containerView
.
addSubview
(
nameLabel
)
nameLabel
.
snp
.
makeConstraints
{
(
make
)
in
make
.
left
.
equalTo
(
valueLabel
)
make
.
right
.
lessThanOrEqualToSuperview
()
.
inset
(
20
)
make
.
top
.
equalTo
(
valueLabel
.
snp
.
bottom
)
.
offset
(
2
)
make
.
bottom
.
equalToSuperview
()
.
inset
(
20
)
}
//Description
descriptionLabel
.
isUserInteractionEnabled
=
false
descriptionLabel
.
font
=
AppFont
.
SFPro
.
regular
(
size
:
12
)
descriptionLabel
.
textColor
=
ThemeManager
.
currentTheme
.
secondaryTextColor
descriptionLabel
.
textAlignment
=
.
left
addSubview
(
descriptionLabel
)
descriptionLabel
.
snp
.
makeConstraints
{
(
make
)
in
make
.
left
.
right
.
equalToSuperview
()
.
inset
(
20
)
make
.
top
.
equalTo
(
imageView
.
snp
.
bottom
)
.
offset
(
20
)
make
.
bottom
.
equalToSuperview
()
.
inset
(
13
)
}
//
//Description
//
descriptionLabel.isUserInteractionEnabled = false
//
descriptionLabel.font = AppFont.SFPro.regular(size: 12)
//
descriptionLabel.textColor = ThemeManager.currentTheme.secondaryTextColor
//
descriptionLabel.textAlignment = .left
//
addSubview(descriptionLabel)
//
//
descriptionLabel.snp.makeConstraints { (make) in
//
make.left.right.equalToSuperview().inset(20)
//
make.top.equalTo(imageView.snp.bottom).offset(20)
//
make.bottom.equalToSuperview().inset(13)
//
}
}
}
1Weather/UI/View controllers/Today/Cells/TodayConditions/TodayConditionsCell.swift
View file @
e5a7196d
...
...
@@ -59,7 +59,7 @@ private extension TodayConditionsCell {
scrollView
.
snp
.
makeConstraints
{
(
make
)
in
make
.
left
.
right
.
equalToSuperview
()
make
.
top
.
equalToSuperview
()
.
inset
(
18
)
make
.
height
.
equalTo
(
115
)
make
.
height
.
equalTo
(
90
)
}
}
...
...
@@ -78,6 +78,9 @@ private extension TodayConditionsCell {
for
conditionType
in
WeatherConditionType
.
allCases
{
let
button
=
TodayConditionButton
(
type
:
conditionType
)
stackView
.
addArrangedSubview
(
button
)
button
.
snp
.
makeConstraints
{
(
make
)
in
make
.
height
.
equalToSuperview
()
}
}
}
...
...
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