宽窄优行-由【嘉易行】项目成品而来
younger_times
2023-07-05 0d8f5fc8a516bfd07e425909e4a4432600572ee7
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
//
//  UseCouponSuccessView.swift
//  OKProject
//
//  Created by 无故事王国 on 2022/2/15.
//  Copyright © 2022 yangwang. All rights reserved.
//
 
import UIKit
 
class UseCouponSuccessView: UIView,NIBLoadable{
 
    @IBOutlet weak var centerView: UIView!
    private var clouse:(()->Void)?
 
    override func awakeFromNib() {
        super.awakeFromNib()
        centerView.transform = CGAffineTransform(scaleX: 0.1, y: 0.1)
        alpha = 0
    }
 
    static func show(_ clouse:@escaping ()->Void){
        let couponSuccessView = UseCouponSuccessView.loadViewFromNib()
        couponSuccessView.frame = CGRect(x: 0, y: 0, width: ScreenWidth, height: ScreenHeight)
        app.window?.addSubview(couponSuccessView)
        couponSuccessView.clouse = clouse
        UIView.animate(withDuration: 0.4) {
            couponSuccessView.centerView.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
            couponSuccessView.alpha = 1
        } completion: { _ in
 
        }
    }
 
    @IBAction func completeAction(_ sender: UIButton) {
        UIView.animate(withDuration: 0.4) {
            self.centerView.transform = CGAffineTransform(scaleX: 0.1, y: 0.1)
            self.alpha = 0
        } completion: { _ in
            self.clouse?()
        }
    }
}