fix
无故事王国
2024-06-20 f2e891eecfac25bf6aed38c8eadfdf05704b16b6
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
46
47
48
49
50
51
52
//
//  ShareView.swift
//  DolphinEnglishLearnStudent
//
//  Created by 无故事王国 on 2024/6/19.
//
 
import UIKit
import JQTools
import QMUIKit
 
class ShareView: UIView,JQNibView{
 
                @IBOutlet weak var view_content: UIView!
                @IBOutlet weak var cons_bottom: NSLayoutConstraint!
                @IBOutlet weak var btn_wx: QMUIButton!
                @IBOutlet weak var btn_wxFri: QMUIButton!
 
                override func awakeFromNib() {
                                super.awakeFromNib()
                                btn_wx.imagePosition = .top
                                btn_wxFri.imagePosition = .top
                                btn_wx.spacingBetweenImageAndTitle = 8
                                btn_wxFri.spacingBetweenImageAndTitle = 8
                                cons_bottom.constant = -JQ_ScreenW
                                alpha = 0
                                layoutIfNeeded()
                }
 
                static func show(){
                                let shareView = ShareView.jq_loadNibView()
                                shareView.frame = sceneDelegate?.window?.frame ?? .zero
                                sceneDelegate?.window?.addSubview(shareView)
                                shareView.cons_bottom.constant = 0
                                UIView.animate(withDuration: 0.4) {
                                                shareView.layoutIfNeeded()
                                                shareView.alpha = 1
 
                                }
                }
 
                @IBAction func closeAction(_ sender: UIButton) {
                                cons_bottom.constant = -JQ_ScreenW
                                UIView.animate(withDuration: 0.4) {
                                                self.alpha = 0
                                                self.layoutIfNeeded()
                                }completion: { _ in
                                                self.removeFromSuperview()
                                }
                }
                
}