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
a53ccc8c
Commit
a53ccc8c
authored
Jul 22, 2024
by
David黄金龙
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'youhua-dev' of
http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS
into youhua-dev
parents
20f0862a
682eeab1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
16 deletions
+76
-16
YHHomeIdentityViewController.swift
...ses/Modules/Home(首页)/C/YHHomeIdentityViewController.swift
+56
-15
YHHomeIdentityCell.swift
...alaxy/Classes/Modules/Home(首页)/V/YHHomeIdentityCell.swift
+20
-1
No files found.
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHHomeIdentityViewController.swift
View file @
a53ccc8c
...
...
@@ -9,13 +9,29 @@
import
UIKit
import
JXSegmentedView
class
YHHomeIdentityViewController
:
YHBaseViewController
{
class
YHHomeIdentityItem
{
var
url
:
String
=
""
var
img
:
UIImage
?
=
nil
var
imgView
:
UIImageView
=
UIImageView
()
func
getSize
()
->
CGSize
{
if
let
img
=
self
.
img
,
img
.
size
.
width
>
0.0
,
img
.
size
.
height
>
0.0
{
return
CGSize
(
width
:
img
.
size
.
width
,
height
:
(
img
.
size
.
height
/
img
.
size
.
width
)
*
KScreenWidth
)
}
return
CGSize
(
width
:
KScreenWidth
,
height
:
KScreenWidth
)
}
init
(
url
:
String
=
""
,
img
:
UIImage
?
=
nil
)
{
self
.
url
=
url
self
.
img
=
img
}
}
var
imgs
:[
UIImage
?]
=
[
UIImage
(
named
:
"identity_talent_1"
),
UIImage
(
named
:
"identity_talent_2"
),
UIImage
(
named
:
"identity_talent_3"
),
UIImage
(
named
:
"identity_talent_4"
)]
class
YHHomeIdentityViewController
:
YHBaseViewController
{
var
imgItems
:[
YHHomeIdentityItem
]
=
[
YHHomeIdentityItem
(
img
:
UIImage
(
named
:
"identity_talent_1"
)),
YHHomeIdentityItem
(
img
:
UIImage
(
named
:
"identity_talent_2"
)),
YHHomeIdentityItem
(
img
:
UIImage
(
named
:
"identity_talent_3"
)),
YHHomeIdentityItem
(
img
:
UIImage
(
named
:
"identity_talent_4"
))]
lazy
var
subTabBar
:
YHIdentityTabBar
=
{
let
items
=
[
YHIdentityTabBarItem
(
title
:
"优才"
,
type
:
.
talent
),
YHIdentityTabBarItem
(
title
:
"高才"
,
type
:
.
high
),
...
...
@@ -25,6 +41,7 @@ class YHHomeIdentityViewController: YHBaseViewController {
bar
.
selectBlock
=
{
[
weak
self
]
type
in
guard
let
self
=
self
else
{
return
}
self
.
tableView
.
setContentOffset
(
.
zero
,
animated
:
true
)
self
.
tableView
.
reloadData
()
if
self
.
segmentedView
.
selectedIndex
!=
0
{
self
.
segmentedView
.
defaultSelectedIndex
=
0
...
...
@@ -159,25 +176,23 @@ extension YHHomeIdentityViewController: UITableViewDataSource, UITableViewDelega
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHHomeIdentityCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHHomeIdentityCell
if
0
<=
indexPath
.
row
,
indexPath
.
row
<
self
.
imgs
.
count
{
if
let
img
=
self
.
imgs
[
indexPath
.
row
]
{
cell
.
image
=
img
}
if
0
<=
indexPath
.
row
,
indexPath
.
row
<
self
.
imgItems
.
count
{
let
item
=
self
.
imgItems
[
indexPath
.
row
]
cell
.
image
=
item
.
img
}
return
cell
}
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
if
0
<=
indexPath
.
row
,
indexPath
.
row
<
self
.
imgs
.
count
{
if
let
img
=
self
.
imgs
[
indexPath
.
row
]
{
return
(
img
.
size
.
height
/
img
.
size
.
width
)
*
KScreenWidth
}
if
0
<=
indexPath
.
row
,
indexPath
.
row
<
self
.
imgItems
.
count
{
let
item
=
self
.
imgItems
[
indexPath
.
row
]
return
item
.
getSize
()
.
height
}
return
0.0
return
KScreenWidth
}
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
return
self
.
imgs
.
count
return
self
.
img
Item
s
.
count
}
func
tableView
(
_
tableView
:
UITableView
,
heightForHeaderInSection
section
:
Int
)
->
CGFloat
{
...
...
@@ -196,3 +211,29 @@ extension YHHomeIdentityViewController: UITableViewDataSource, UITableViewDelega
return
UIView
()
}
}
extension
YHHomeIdentityViewController
{
func
requestData
()
{
}
func
requestImages
()
{
let
ossGroup
=
DispatchGroup
()
for
item
in
self
.
imgItems
{
ossGroup
.
enter
()
item
.
imgView
.
kf
.
setImage
(
with
:
URL
(
string
:
item
.
url
))
{
result
in
switch
result
{
case
.
success
(
let
value
):
item
.
img
=
value
.
image
case
.
failure
(
let
error
):
print
(
"image download failed:
\(
error
.
localizedDescription
)
"
)
}
ossGroup
.
leave
()
}
}
ossGroup
.
notify
(
queue
:
.
main
)
{
self
.
tableView
.
reloadData
()
}
}
}
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHHomeIdentityCell.swift
View file @
a53ccc8c
...
...
@@ -13,7 +13,14 @@ class YHHomeIdentityCell: UITableViewCell {
static
let
cellReuseIdentifier
=
"YHHomeIdentityCell"
var
image
:
UIImage
?
=
UIImage
(
named
:
"global_default_image"
)
{
didSet
{
imgView
.
image
=
image
if
let
img
=
image
{
imgView
.
image
=
img
self
.
bottomLineView
.
isHidden
=
false
}
else
{
imgView
.
image
=
UIImage
(
named
:
"global_default_image"
)
self
.
bottomLineView
.
isHidden
=
false
}
}
}
...
...
@@ -23,6 +30,12 @@ class YHHomeIdentityCell: UITableViewCell {
return
view
}()
lazy
var
bottomLineView
:
UIView
=
{
let
view
=
UIView
()
view
.
backgroundColor
=
.
separatorColor
return
view
}()
override
init
(
style
:
UITableViewCell
.
CellStyle
,
reuseIdentifier
:
String
?)
{
super
.
init
(
style
:
style
,
reuseIdentifier
:
reuseIdentifier
)
setupUI
()
...
...
@@ -34,8 +47,14 @@ class YHHomeIdentityCell: UITableViewCell {
func
setupUI
()
{
self
.
contentView
.
addSubview
(
self
.
imgView
)
self
.
contentView
.
addSubview
(
self
.
bottomLineView
)
self
.
imgView
.
snp
.
makeConstraints
{
make
in
make
.
edges
.
equalToSuperview
()
}
self
.
bottomLineView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
bottom
.
equalToSuperview
()
make
.
height
.
equalTo
(
1.0
)
}
}
}
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