宽窄优行-由【嘉易行】项目成品而来
younger_times
2023-06-12 cc8902d86a58d6ccb7ee19c0d87cc65044e5fbf9
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
53
54
55
//
//  AuthRecordView.swift
//  OKProject
//
//  Created by 杨锴 on 2023/6/12.
//  Copyright © 2023 yangwang. All rights reserved.
//
 
import UIKit
 
class AuthRecordView: UIView,LDNibView{
 
    @IBOutlet weak var view_container: UIView!
    @IBOutlet weak var label_content: UILabel!
    
    private var clouse:(()->Void)!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        view_container.transform = .init(scaleX: 0.1, y: 0.1)
        alpha = 0
        layoutIfNeeded()
    }
    
    static func show(_ clouse:@escaping ()->Void){
        let authRecordView = AuthRecordView.ld_loadNibView()
        authRecordView.clouse = clouse
        authRecordView.frame = app.window?.frame ?? .zero
        app.window?.addSubview(authRecordView)
        
        UIView.animate(withDuration: 0.4) {
            authRecordView.view_container.transform = .init(scaleX: 1.0, y: 1.0)
            authRecordView.alpha = 1
        }
    }
    
    @IBAction func settingAction(_ sender: UIButton) {
        UIView.animate(withDuration: 0.4) {
            self.view_container.transform = .init(scaleX: 0.1, y: 0.1)
            self.alpha = 0
        } completion: { _ in
            self.removeFromSuperview()
            self.clouse()
        }
    }
    
    @IBAction func closeAction(_ sender: UIButton) {
        UIView.animate(withDuration: 0.4) {
            self.view_container.transform = .init(scaleX: 0.1, y: 0.1)
            self.alpha = 0
        } completion: { _ in
            self.removeFromSuperview()
        }
    }
}