//
|
// 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?()
|
}
|
}
|
}
|