杨锴
2024-08-14 909e20941e45f8712c012db602034b47da0bfdb0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
//  ShareView.swift
//  XQMuse
//
//  Created by 无故事王国 on 2024/8/14.
//
 
import UIKit
import JQTools
 
class ShareView: UIView,JQNibView{
 
                @IBOutlet weak var view_content: UIView!
                @IBOutlet weak var cons_bottom: NSLayoutConstraint!
                
                override func awakeFromNib() {
                                super.awakeFromNib()
 
                                alpha = 0
                                cons_bottom.constant = -JQ_ScreenW
                                layoutIfNeeded()
                }
 
                static func show(){
                                let shareView = ShareView.jq_loadNibView()
                                sceneDelegate?.window?.addSubview(shareView)
                                shareView.frame = sceneDelegate?.window?.frame ?? .zero
                                shareView.cons_bottom.constant = 0
 
                                UIView.animate(withDuration: 0.4) {
                                                shareView.layoutIfNeeded()
                                                shareView.alpha = 1
                                }
                }
 
                @IBAction func cancelAction(_ sender: UIButton) {
                                self.cons_bottom.constant = -JQ_ScreenW
                                UIView.animate(withDuration: 0.4) {
                                                self.layoutIfNeeded()
                                                self.alpha = 0
                                } completion: { _ in
                                                self.removeFromSuperview()
                                }
                }
}