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
ab61a4b4
Commit
ab61a4b4
authored
Jun 19, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 卡片动效
parent
4fca4d46
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
102 additions
and
6 deletions
+102
-6
Podfile
galaxy/Podfile
+2
-0
YHMatchPeopleViewController.swift
...Modules/Community(社区)/C/YHMatchPeopleViewController.swift
+93
-3
YHFriendRequestView.swift
...Classes/Modules/Community(社区)/V/YHFriendRequestView.swift
+5
-2
YHNameCardInfoView.swift
.../Classes/Modules/Community(社区)/V/YHNameCardInfoView.swift
+2
-1
No files found.
galaxy/Podfile
View file @
ab61a4b4
...
@@ -87,6 +87,8 @@ target 'galaxy' do
...
@@ -87,6 +87,8 @@ target 'galaxy' do
pod
'lottie-ios'
,
'4.4.0'
pod
'lottie-ios'
,
'4.4.0'
#GIF图播放
#GIF图播放
pod
'YYImage'
,
'1.0.4'
pod
'YYImage'
,
'1.0.4'
#滑动卡片
pod
'DragCardContainer'
end
end
...
...
galaxy/galaxy/Classes/Modules/Community(社区)/C/YHMatchPeopleViewController.swift
View file @
ab61a4b4
...
@@ -7,11 +7,12 @@
...
@@ -7,11 +7,12 @@
//
//
import
UIKit
import
UIKit
import
DragCardContainer
class
YHMatchPeopleViewController
:
YHBaseViewController
{
class
YHMatchPeopleViewController
:
YHBaseViewController
{
var
match
Arr
:[
String
]
=
[
""
,
""
,
""
]
var
match
CardsArr
:[
String
]
=
[
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
]
lazy
var
bgImgV
:
UIImageView
=
{
lazy
var
bgImgV
:
UIImageView
=
{
let
bg
=
UIImageView
(
image
:
UIImage
(
named
:
"people_match_result_bg"
))
let
bg
=
UIImageView
(
image
:
UIImage
(
named
:
"people_match_result_bg"
))
...
@@ -46,6 +47,39 @@ class YHMatchPeopleViewController: YHBaseViewController {
...
@@ -46,6 +47,39 @@ class YHMatchPeopleViewController: YHBaseViewController {
return
btn
return
btn
}()
}()
private
let
allowedDirection
:
[
Direction
]
=
[
.
left
,
.
up
,
.
right
]
lazy
var
cardContainer
:
DragCardContainer
=
{
let
cardContainer
=
DragCardContainer
()
// 是否可以无限滑动
cardContainer
.
infiniteLoop
=
false
// 数据源
cardContainer
.
dataSource
=
self
// 代理
cardContainer
.
delegate
=
self
// 可见卡片数量
cardContainer
.
visibleCount
=
3
// 是否可以打印日志
cardContainer
.
enableLog
=
true
// 是否禁用卡片拖动
cardContainer
.
disableTopCardDrag
=
false
// 是否禁用卡片点击
cardContainer
.
disableTopCardClick
=
false
let
mode
=
ScaleMode
()
// 卡片之间间距
mode
.
cardSpacing
=
5
// 方向(可以运行Demo,修改该参数看实际效果)
mode
.
direction
=
.
bottom
// 最小缩放比例
mode
.
minimumScale
=
0.9
// 卡片最大旋转角度
mode
.
maximumAngle
=
0
// 赋值mode
cardContainer
.
mode
=
mode
cardContainer
.
isHidden
=
true
return
cardContainer
}()
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
createUI
()
createUI
()
...
@@ -65,8 +99,9 @@ class YHMatchPeopleViewController: YHBaseViewController {
...
@@ -65,8 +99,9 @@ class YHMatchPeopleViewController: YHBaseViewController {
let
wingRightImgV
=
UIImageView
(
image
:
UIImage
(
named
:
"people_match_wing_right"
))
let
wingRightImgV
=
UIImageView
(
image
:
UIImage
(
named
:
"people_match_wing_right"
))
self
.
view
.
addSubview
(
wingRightImgV
)
self
.
view
.
addSubview
(
wingRightImgV
)
self
.
view
.
addSubview
(
cardContainer
)
self
.
bgImgV
.
snp
.
makeConstraints
{
make
in
self
.
bgImgV
.
snp
.
makeConstraints
{
make
in
make
.
edges
.
equalToSuperview
()
make
.
edges
.
equalToSuperview
()
}
}
...
@@ -104,6 +139,14 @@ class YHMatchPeopleViewController: YHBaseViewController {
...
@@ -104,6 +139,14 @@ class YHMatchPeopleViewController: YHBaseViewController {
make
.
left
.
equalTo
(
self
.
topLabel
.
snp
.
right
)
make
.
left
.
equalTo
(
self
.
topLabel
.
snp
.
right
)
make
.
centerY
.
equalTo
(
self
.
topLabel
)
make
.
centerY
.
equalTo
(
self
.
topLabel
)
}
}
cardContainer
.
snp
.
makeConstraints
{
make
in
make
.
centerX
.
equalToSuperview
()
make
.
left
.
equalTo
(
36
)
make
.
right
.
equalTo
(
-
36
)
make
.
top
.
equalToSuperview
()
.
offset
(
102
+
k_Height_NavigationtBarAndStatuBar
)
make
.
height
.
equalTo
(
456.0
)
}
animaiton
()
animaiton
()
}
}
...
@@ -137,7 +180,54 @@ class YHMatchPeopleViewController: YHBaseViewController {
...
@@ -137,7 +180,54 @@ class YHMatchPeopleViewController: YHBaseViewController {
UIView
.
animate
(
withDuration
:
0.5
,
delay
:
0.1
,
options
:
[
.
curveEaseInOut
])
{
UIView
.
animate
(
withDuration
:
0.5
,
delay
:
0.1
,
options
:
[
.
curveEaseInOut
])
{
view1
.
y
=
102
+
k_Height_NavigationtBarAndStatuBar
view1
.
y
=
102
+
k_Height_NavigationtBarAndStatuBar
}
completion
:
{
finish
in
}
}
completion
:
{
[
weak
self
]
finish
in
guard
let
self
=
self
else
{
return
}
self
.
cardContainer
.
isHidden
=
false
view1
.
isHidden
=
true
view2
.
isHidden
=
true
view3
.
isHidden
=
true
}
}
}
extension
YHMatchPeopleViewController
:
DragCardDataSource
{
public
func
numberOfCards
(
_
dragCard
:
DragCardContainer
)
->
Int
{
return
matchCardsArr
.
count
}
public
func
dragCard
(
_
dragCard
:
DragCardContainer
,
viewForCard
index
:
Int
)
->
DragCardView
{
let
cardView
:
YHNameCardInfoView
=
YHNameCardInfoView
.
createCardView
()
cardView
.
allowedDirection
=
self
.
allowedDirection
if
index
%
3
==
0
{
cardView
.
cardView
.
backgroundColor
=
.
white
}
else
if
index
%
3
==
1
{
cardView
.
cardView
.
backgroundColor
=
UIColor
.
init
(
hex
:
0xE7EBF3
)
}
else
if
index
%
3
==
2
{
cardView
.
cardView
.
backgroundColor
=
UIColor
.
init
(
hex
:
0xC4CEE3
)
}
return
cardView
}
}
extension
YHMatchPeopleViewController
:
DragCardDelegate
{
public
func
dragCard
(
_
dragCard
:
DragCardContainer
,
displayTopCardAt
index
:
Int
,
with
cardView
:
DragCardView
)
{
print
(
"displayTopCardAt:
\(
index
)
"
)
}
public
func
dragCard
(
_
dragCard
:
DragCardContainer
,
didRemovedTopCardAt
index
:
Int
,
direction
:
Direction
,
with
cardView
:
DragCardView
)
{
print
(
"didRemovedTopCardAt:
\(
index
)
"
)
}
public
func
dragCard
(
_
dragCard
:
DragCardContainer
,
didRemovedLast
cardView
:
DragCardView
)
{
print
(
"didRemovedLast"
)
}
public
func
dragCard
(
_
dragCard
:
DragCardContainer
,
didSelectTopCardAt
index
:
Int
,
with
cardView
:
DragCardView
)
{
print
(
"didSelectTopCardAt:
\(
index
)
"
)
}
}
}
}
galaxy/galaxy/Classes/Modules/Community(社区)/V/YHFriendRequestView.swift
View file @
ab61a4b4
...
@@ -75,6 +75,8 @@ class YHFriendRequestView: UIView {
...
@@ -75,6 +75,8 @@ class YHFriendRequestView: UIView {
btn
.
setTitleColor
(
.
brandMainColor
,
for
:
.
normal
)
btn
.
setTitleColor
(
.
brandMainColor
,
for
:
.
normal
)
btn
.
titleLabel
?
.
font
=
.
PFSC_M
(
ofSize
:
14
)
btn
.
titleLabel
?
.
font
=
.
PFSC_M
(
ofSize
:
14
)
btn
.
layer
.
cornerRadius
=
3
btn
.
layer
.
cornerRadius
=
3
btn
.
layer
.
borderWidth
=
1.0
btn
.
layer
.
borderColor
=
UIColor
.
brandMainColor
.
cgColor
btn
.
addTarget
(
self
,
action
:
#selector(
didCancelBtnClicked
)
,
for
:
.
touchUpInside
)
btn
.
addTarget
(
self
,
action
:
#selector(
didCancelBtnClicked
)
,
for
:
.
touchUpInside
)
return
btn
return
btn
}()
}()
...
@@ -113,10 +115,11 @@ class YHFriendRequestView: UIView {
...
@@ -113,10 +115,11 @@ class YHFriendRequestView: UIView {
}
}
@objc
func
didCancelBtnClicked
()
{
@objc
func
didCancelBtnClicked
()
{
dismiss
()
}
}
@objc
func
didSendBtnClicked
()
{
@objc
func
didSendBtnClicked
()
{
dismiss
()
}
}
func
createUI
()
{
func
createUI
()
{
...
@@ -146,7 +149,7 @@ class YHFriendRequestView: UIView {
...
@@ -146,7 +149,7 @@ class YHFriendRequestView: UIView {
cardView
.
snp
.
makeConstraints
{
make
in
cardView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
38
)
make
.
left
.
equalTo
(
38
)
make
.
right
.
equalTo
(
-
38
)
make
.
right
.
equalTo
(
-
38
)
make
.
center
X
.
equalToSuperview
()
make
.
center
Y
.
equalToSuperview
()
make
.
height
.
equalTo
(
313
)
make
.
height
.
equalTo
(
313
)
}
}
...
...
galaxy/galaxy/Classes/Modules/Community(社区)/V/YHNameCardInfoView.swift
View file @
ab61a4b4
...
@@ -7,8 +7,9 @@
...
@@ -7,8 +7,9 @@
//
//
import
UIKit
import
UIKit
import
DragCardContainer
class
YHNameCardInfoView
:
UI
View
{
class
YHNameCardInfoView
:
DragCard
View
{
static
let
height
=
456.0
static
let
height
=
456.0
static
let
width
=
KScreenWidth
-
36.0
*
2
static
let
width
=
KScreenWidth
-
36.0
*
2
...
...
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