Commit 964b4818 authored by CZ1004's avatar CZ1004

【优化】弹窗动画

parent b860064e
......@@ -195,6 +195,17 @@ class AdvTipDeleteView : UIView {
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 {
......@@ -268,7 +279,8 @@ extension AdvTipDeleteView : UICollectionViewDataSource, UICollectionViewDelegat
// 先显示背景,然后延迟显示弹框
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
UIView.animate(withDuration: 0.1) {
UIView.animate(withDuration: 0.2) {
// 更新约束
self.centerYConstraint?.update(offset: 0)
self.layoutIfNeeded()
......
......@@ -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{
......
......@@ -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) {
fatalError("init(coder:) has not been implemented")
}
......
......@@ -89,9 +89,16 @@ class SecretActionView: UIViewController {
}
@objc private func touchDismiss(){
UIView.animate(withDuration: 0.2) {
// 更新约束
self.selectedViewBottomConstraint?.update(offset: 1000)
self.view.layoutIfNeeded()
}completion: { _ in
self.dismiss(animated: true)
}
}
func show() -> Void {
guard let rt = cWindow?.rootViewController else { return }
......
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