Commit 964b4818 authored by CZ1004's avatar CZ1004

【优化】弹窗动画

parent b860064e
...@@ -195,6 +195,17 @@ class AdvTipDeleteView : UIView { ...@@ -195,6 +195,17 @@ class AdvTipDeleteView : UIView {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
override func removeFromSuperview() {
UIView.animate(withDuration: 0.2) {
// 更新约束
self.backgroundColor = .clear
self.centerYConstraint?.update(offset: self.height + 205)
self.layoutIfNeeded()
}completion: { _ in
super.removeFromSuperview()
}
}
} }
extension AdvTipDeleteView : UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { extension AdvTipDeleteView : UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
...@@ -268,7 +279,8 @@ extension AdvTipDeleteView : UICollectionViewDataSource, UICollectionViewDelegat ...@@ -268,7 +279,8 @@ extension AdvTipDeleteView : UICollectionViewDataSource, UICollectionViewDelegat
// 先显示背景,然后延迟显示弹框 // 先显示背景,然后延迟显示弹框
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
UIView.animate(withDuration: 0.1) {
UIView.animate(withDuration: 0.2) {
// 更新约束 // 更新约束
self.centerYConstraint?.update(offset: 0) self.centerYConstraint?.update(offset: 0)
self.layoutIfNeeded() self.layoutIfNeeded()
......
...@@ -193,6 +193,17 @@ class AdvTipSelectView : UIView { ...@@ -193,6 +193,17 @@ class AdvTipSelectView : UIView {
} }
} }
override func removeFromSuperview() {
UIView.animate(withDuration: 0.2) {
// 更新约束
self.backgroundColor = .clear
self.centerYConstraint?.update(offset: self.height + 220)
self.layoutIfNeeded()
}completion: { _ in
super.removeFromSuperview()
}
}
} }
extension AdvTipSelectView{ extension AdvTipSelectView{
......
...@@ -102,6 +102,17 @@ class CompressSortView: UIView, UITableViewDelegate, UITableViewDataSource { ...@@ -102,6 +102,17 @@ class CompressSortView: UIView, UITableViewDelegate, UITableViewDataSource {
} }
} }
override func removeFromSuperview() {
UIView.animate(withDuration: 0.2) {
// 更新约束
self.backView.backgroundColor = .clear
self.selectedViewBottomConstraint?.update(offset: 416)
self.layoutIfNeeded()
}completion: { _ in
super.removeFromSuperview()
}
}
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
......
...@@ -89,7 +89,14 @@ class SecretActionView: UIViewController { ...@@ -89,7 +89,14 @@ class SecretActionView: UIViewController {
} }
@objc private func touchDismiss(){ @objc private func touchDismiss(){
self.dismiss(animated: true) UIView.animate(withDuration: 0.2) {
// 更新约束
self.selectedViewBottomConstraint?.update(offset: 1000)
self.view.layoutIfNeeded()
}completion: { _ in
self.dismiss(animated: true)
}
} }
......
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