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
26efa1fb
Commit
26efa1fb
authored
May 08, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 视频底部收藏点赞
parent
d484ed9a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
11 deletions
+47
-11
YHHomeWebBottomButton.swift
...xy/Classes/Modules/Home(首页)/V/YHHomeWebBottomButton.swift
+2
-2
YHHomeWebBottomView.swift
...laxy/Classes/Modules/Home(首页)/V/YHHomeWebBottomView.swift
+45
-9
No files found.
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHHomeWebBottomButton.swift
View file @
26efa1fb
...
...
@@ -47,9 +47,9 @@ class YHHomeWebBottomButton: UIButton {
}
}
func
setContent
(
_
image
:
String
,
_
title
:
String
)
{
func
setContent
(
_
image
:
UIImage
?
,
_
title
:
String
)
{
bottomTitleLabel
.
text
=
title
topImageView
.
image
=
UIImage
(
named
:
image
)
topImageView
.
image
=
image
}
/*
// Only override draw() if you perform custom drawing.
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHHomeWebBottomView.swift
View file @
26efa1fb
...
...
@@ -8,7 +8,15 @@
import
UIKit
enum
YHTintColorMode
{
case
light
case
dark
}
class
YHHomeWebBottomView
:
UIView
{
static
let
height
=
59.0
typealias
Block
=
(
Bool
)
->
()
var
likeBlock
:
Block
?
var
starBlock
:
Block
?
...
...
@@ -18,27 +26,55 @@ class YHHomeWebBottomView: UIView {
var
starCount
:
Int
=
0
var
isStar
:
Bool
=
false
{
didSet
{
var
imgName
=
"home_web_star"
if
isStar
{
starButton
.
setContent
(
"home_web_stared"
,
"
\(
starCount
)
"
)
}
else
{
starButton
.
setContent
(
"home_web_star"
,
"
\(
starCount
)
"
)
imgName
=
"home_web_stared"
}
var
image
=
UIImage
(
named
:
imgName
)
if
tintMode
==
.
dark
{
starButton
.
bottomTitleLabel
.
textColor
=
.
white
if
!
isStar
{
image
=
image
?
.
withRenderingMode
(
.
alwaysTemplate
)
.
withTintColor
(
.
white
)
starButton
.
topImageView
.
tintColor
=
.
white
}
}
starButton
.
setContent
(
image
,
"
\(
starCount
)
"
)
}
}
//是否收藏
var
isLike
:
Bool
=
false
{
didSet
{
var
imgName
=
"home_web_like"
if
isLike
{
likeButton
.
setContent
(
"home_web_liked"
,
"
\(
likeCount
)
"
)
}
else
{
likeButton
.
setContent
(
"home_web_like"
,
"
\(
likeCount
)
"
)
imgName
=
"home_web_liked"
}
var
image
=
UIImage
(
named
:
imgName
)
if
tintMode
==
.
dark
{
likeButton
.
bottomTitleLabel
.
textColor
=
.
white
if
!
isLike
{
image
=
image
?
.
withRenderingMode
(
.
alwaysTemplate
)
.
withTintColor
(
.
white
)
likeButton
.
topImageView
.
tintColor
=
.
white
}
}
likeButton
.
setContent
(
image
,
"
\(
likeCount
)
"
)
}
}
//是否点赞
var
tintMode
:
YHTintColorMode
=
.
light
{
didSet
{
if
tintMode
==
.
light
{
self
.
backgroundColor
=
.
white
}
else
if
tintMode
==
.
dark
{
self
.
backgroundColor
=
.
black
}
}
}
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
backgroundColor
=
.
white
tintMode
=
.
light
setUpView
()
}
...
...
@@ -50,7 +86,7 @@ class YHHomeWebBottomView: UIView {
likeButton
=
{
let
button
=
YHHomeWebBottomButton
()
button
.
setContent
(
"home_web_like"
,
"0"
)
button
.
setContent
(
UIImage
(
named
:
"home_web_like"
)
,
"0"
)
button
.
addTarget
(
self
,
action
:
#selector(
likeBtnClick
)
,
for
:
.
touchUpInside
)
return
button
}()
...
...
@@ -64,7 +100,7 @@ class YHHomeWebBottomView: UIView {
starButton
=
{
let
button
=
YHHomeWebBottomButton
()
button
.
setContent
(
"home_web_star"
,
"0"
)
button
.
setContent
(
UIImage
(
named
:
"home_web_star"
)
,
"0"
)
button
.
addTarget
(
self
,
action
:
#selector(
starBtnClick
)
,
for
:
.
touchUpInside
)
return
button
}()
...
...
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