Commit 10e976d5 authored by Steven杜宇's avatar Steven杜宇

// 动画优化

parent 20b894c4
......@@ -284,17 +284,12 @@ class YHMatchResultListViewController: YHBaseViewController {
func animaiton() {
if self.matchUsersArr.count <= 0 {
return
}
let view3 = YHNameCardInfoView.createCardView()
view3.backgroundColor = UIColor.init(hex: 0xC4CEE3)
view3.y = -YHNameCardInfoView.height
view3.x = 36+10
view3.width = YHNameCardInfoView.width-5*4
view3.isHidden = self.matchUsersArr.count >= 3
view3.isHidden = self.matchUsersArr.count < 3
if self.matchUsersArr.count >= 3 {
if let user = self.matchUsersArr[2] {
view3.userModel = user
......@@ -307,7 +302,7 @@ class YHMatchResultListViewController: YHBaseViewController {
view2.y = -YHNameCardInfoView.height
view2.x = 36+5
view2.width = YHNameCardInfoView.width-5*2
view2.isHidden = self.matchUsersArr.count >= 2
view2.isHidden = self.matchUsersArr.count < 2
self.view.addSubview(view2)
if self.matchUsersArr.count >= 2 {
if let user = self.matchUsersArr[1] {
......@@ -318,28 +313,42 @@ class YHMatchResultListViewController: YHBaseViewController {
let view1 = YHNameCardInfoView.createCardView()
view1.y = -YHNameCardInfoView.height
view1.x = 36
view1.width = YHNameCardInfoView.width
self.view.addSubview(view1)
if self.matchUsersArr.count >= 0 {
if let user = self.matchUsersArr[0] {
view1.userModel = user
}
}
var delay1Time = 0.2
if self.matchUsersArr.count >= 3 {
delay1Time = 0.2
} else if self.matchUsersArr.count >= 2 {
delay1Time = 0.1
} else if self.matchUsersArr.count >= 1 {
delay1Time = 0.0
}
let delay2Time = delay1Time-0.1 >= 0.0 ? delay1Time-0.1 : 0.0
let delay3Time = delay2Time-0.1 >= 0.0 ? delay2Time-0.1 : 0.0
UIView.animate(withDuration: 0.5, delay: 0, options: [.curveEaseInOut]) {
UIView.animate(withDuration: 0.5, delay: delay3Time, options: [.curveEaseInOut]) {
view3.y = 102+k_Height_NavigationtBarAndStatuBar+5*2
} completion: { finish in }
UIView.animate(withDuration: 0.5, delay: 0.1, options: [.curveEaseInOut]) {
UIView.animate(withDuration: 0.5, delay: delay2Time, options: [.curveEaseInOut]) {
view2.y = 102+k_Height_NavigationtBarAndStatuBar+5
} completion: { finish in }
UIView.animate(withDuration: 0.5, delay: 0.1, options: [.curveEaseInOut]) {
UIView.animate(withDuration: 0.5, delay: delay1Time, options: [.curveEaseInOut]) {
view1.y = 102+k_Height_NavigationtBarAndStatuBar
} completion: {
[weak self] finish in
guard let self = self else { return }
self.cardContainer.isHidden = false
self.guideView.isHidden = false
self.view.bringSubviewToFront(self.guideView)
view1.removeFromSuperview()
view2.removeFromSuperview()
view3.removeFromSuperview()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment