younger_times
2023-06-14 177ae5f9f619bd39e2d505709d8c5b419e7867ee
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
//
//  StudentUpdateInfoView.swift
//  WanPai
//
//  Created by 杨锴 on 2023/6/14.
//
 
import UIKit
import JQTools
 
class StudentUpdateInfoView: UIView,JQNibView{
 
    @IBOutlet weak var view_container: UIView!
    @IBOutlet weak var cons_bottom: NSLayoutConstraint!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        cons_bottom.constant = -(JQ_ScreenW / 2)
        alpha = 0
        layoutIfNeeded()
    }
    
    static func show(){
        let storesView = StudentUpdateInfoView.jq_loadNibView()
        storesView.frame = screnDelegate?.window?.frame ?? .zero
        screnDelegate?.window?.addSubview(storesView)
        storesView.cons_bottom.constant = 0
        
        UIView.animate(withDuration: 0.4) {
            storesView.alpha = 1
            storesView.layoutIfNeeded()
        }
    }
    
    private func close(){
        self.cons_bottom.constant = -(JQ_ScreenW / 2)
        UIView.animate(withDuration: 0.4) {
            self.alpha = 0
            self.layoutIfNeeded()
        } completion: { _ in
            self.removeFromSuperview()
        }
    }
}