From 46acca18a3d1744e1930f0bac7509a2a5959df1b Mon Sep 17 00:00:00 2001 From: 无故事王国 <841720330@qq.com> Date: 星期三, 26 六月 2024 18:58:14 +0800 Subject: [PATCH] fix --- DolphinEnglishLearnStudent/Other/UIView/CommonAlertView.swift | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/DolphinEnglishLearnStudent/Other/UIView/CommonAlertView.swift b/DolphinEnglishLearnStudent/Other/UIView/CommonAlertView.swift index 483b6ea..2f609a8 100644 --- a/DolphinEnglishLearnStudent/Other/UIView/CommonAlertView.swift +++ b/DolphinEnglishLearnStudent/Other/UIView/CommonAlertView.swift @@ -16,6 +16,7 @@ @IBOutlet weak var cons_btnClose: NSLayoutConstraint! private var clouse:(()->Void)? + private var cancelClouse:(()->Void)? override func awakeFromNib() { super.awakeFromNib() self.alpha = 0 @@ -47,12 +48,35 @@ } } + static func showSimple(content:String,completeTitle:String? = nil,cancelClouse:@escaping (()->Void)){ + let commonAlertView = CommonAlertView.jq_loadNibView() + sceneDelegate?.window?.addSubview(commonAlertView) + commonAlertView.label_content.text = content + commonAlertView.label_content.numberOfLines = 0 + commonAlertView.label_content.textAlignment = .center + commonAlertView.cancelClouse = cancelClouse + commonAlertView.frame = sceneDelegate?.window?.frame ?? .zero + + commonAlertView.btn_complete.isHidden = true + commonAlertView.cons_btnClose.constant = 219 + commonAlertView.btn_close.backgroundColor = Config.ThemeColor + commonAlertView.btn_close.jq_borderWidth = 0 + commonAlertView.btn_close.setTitleColor(.white, for: .normal) + + UIView.animate(withDuration: 0.4) { + commonAlertView.alpha = 1 + commonAlertView.view_container.transform = .init(translationX: 1.0, y: 1.0) + commonAlertView.layoutIfNeeded() + } + } + @IBAction func closeAction(_ sender: UIButton) { UIView.animate(withDuration: 0.4) { self.alpha = 0 self.view_container.transform = .init(scaleX: 0.1, y: 0.1) } completion: { _ in self.removeFromSuperview() + self.cancelClouse?() } } -- Gitblit v1.7.1