From 0fb7413df54760ac6bd15b90b738e0706de1629e Mon Sep 17 00:00:00 2001 From: 杨锴 <841720330@qq.com> Date: 星期二, 05 十一月 2024 19:03:09 +0800 Subject: [PATCH] fix bug --- XQMuse/Root/Other/View/CommonAlertSheetView.swift | 28 ++++++++++++++++++++++++---- 1 files changed, 24 insertions(+), 4 deletions(-) diff --git a/XQMuse/Root/Other/View/CommonAlertSheetView.swift b/XQMuse/Root/Other/View/CommonAlertSheetView.swift index 4ac98fa..8de2f64 100644 --- a/XQMuse/Root/Other/View/CommonAlertSheetView.swift +++ b/XQMuse/Root/Other/View/CommonAlertSheetView.swift @@ -14,23 +14,32 @@ @IBOutlet weak var tableView: UITableView! @IBOutlet weak var cons_tableHei: NSLayoutConstraint! @IBOutlet weak var cons_viewBottom: NSLayoutConstraint! - + @IBOutlet weak var cons_titleH: NSLayoutConstraint! + @IBOutlet weak var view_title: UIView! + private var items = [String]() private var clouse:((Int)->Void)! + private var hiddenTitle:Bool = false override func awakeFromNib() { super.awakeFromNib() alpha = 0 + cons_viewBottom.constant = -JQ_ScreenW layoutIfNeeded() tableView.delegate = self tableView.dataSource = self tableView.separatorStyle = .none + tableView.isScrollEnabled = false tableView.register(CommonAlertSheetTCell.self, forCellReuseIdentifier: "TCell") } - static func show(items:[String],clouse:@escaping (Int)->Void){ + static func show(items:[String],hiddenTitle:Bool = false,clouse:@escaping (Int)->Void){ let alertView = CommonAlertSheetView.jq_loadNibView() + alertView.hiddenTitle = hiddenTitle + alertView.cons_titleH.constant = hiddenTitle ? 0:56 + alertView.view_title.isHidden = hiddenTitle + alertView.frame = sceneDelegate?.window?.frame ?? .zero alertView.cons_tableHei.constant = CGFloat(items.count * 56) sceneDelegate?.window?.addSubview(alertView) @@ -48,7 +57,13 @@ override func layoutSubviews() { super.layoutSubviews() - let totalH = Double(items.count * 56) + UIDevice.jq_safeEdges.bottom + 56 + var totalH:Double = 0 + if hiddenTitle{ + totalH = Double(items.count * 56) + UIDevice.jq_safeEdges.bottom + 56.0 + }else{ + totalH = Double(items.count * 56) + UIDevice.jq_safeEdges.bottom + 56.0 + 56.0 + } + view_container.jq_addCorners(corner: [.topLeft,.topRight], radius: 20,height: totalH) } @@ -82,6 +97,11 @@ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "TCell") as! CommonAlertSheetTCell cell.label_content.text = items[indexPath.row] + if hiddenTitle{ + cell.label_content.textColor = UIColor(hexString: "#6B6B6B") + }else{ + cell.label_content.textColor = UIColor(hexString: "#92A87D") + } return cell } @@ -109,7 +129,7 @@ } let lineView = UIView() - lineView.backgroundColor = UIColor(hexStr: "#979797").withAlphaComponent(0.05) + lineView.backgroundColor = UIColor(hexStr: "#979797").withAlphaComponent(0.1) contentView.addSubview(lineView) lineView.snp.makeConstraints { make in make.left.equalTo(15) -- Gitblit v1.7.1