// // UpdateAlertView.swift // CommonFrame // // Created by Virgil on 2019/1/3. // Copyright © 2019年 Virgil. All rights reserved. // import UIKit class UpdateAlertView: UIView { @IBOutlet weak var btnUpgrade: UIButton! @IBOutlet weak var btnClose: UIButton! @IBOutlet weak var lblContent: UITextView! /* // Only override draw() if you perform custom drawing. // An empty implementation adversely affects performance during animation. override func draw(_ rect: CGRect) { // Drawing code } */ @IBAction func btnCloseClick(_ sender: Any) { appDelegate.navController.hiddenBackgroudView() } @IBAction func btnUpdate(_ sender: Any) { if upGradeUrl != "" { UIApplication.shared.openURL(NSURL(string: upGradeUrl)! as URL) } } var upGradeUrl = "" func initView(alert: String, upgradeUrl: String) { self.setSizeWidth(width: ScreenWidth - 80) upGradeUrl = upgradeUrl lblContent.text = alert lblContent.sizeToFit() if lblContent.height() > 130 { lblContent.setSizeHeight(height: 130) } else if lblContent.height() < 40 { lblContent.setSizeHeight(height: 40) } btnUpgrade.setCornerRadius(size: 8) self.setCornerRadius(size: 12) btnUpgrade.marginTop(top: 20, view: lblContent) self.setSizeHeight(height: btnUpgrade.bottom() + 30) } }