From 54e863346e9c246d199c7684e506de4f7437b3bb Mon Sep 17 00:00:00 2001
From: 无故事王国 <841720330@qq.com>
Date: 星期一, 16 十月 2023 18:58:28 +0800
Subject: [PATCH] 修改

---
 WanPai/Root/Course/View/CityChooseSubTypeView.swift |   60 ++++++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 48 insertions(+), 12 deletions(-)

diff --git a/WanPai/Root/Course/View/CityChooseSubTypeView.swift b/WanPai/Root/Course/View/CityChooseSubTypeView.swift
index 0250b32..f4be3af 100644
--- a/WanPai/Root/Course/View/CityChooseSubTypeView.swift
+++ b/WanPai/Root/Course/View/CityChooseSubTypeView.swift
@@ -34,7 +34,7 @@
 		}
 		tableView.separatorStyle = .none
         tableView.sectionIndexColor = Def_ThemeColor
-        tableView.register(UINib(nibName: "CommonSingleTCell", bundle: nil), forCellReuseIdentifier: "_CommonSingleTCell")
+//        tableView.register(UINib(nibName: "CommonSingleTCell", bundle: nil), forCellReuseIdentifier: "_CommonSingleTCell")
         startLocation()
         Services.queryAllCity().subscribe(onNext: {[weak self] data in
 			guard let weakSelf = self else { return }
@@ -133,9 +133,30 @@
         return keys
     }
 
-    func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
-        return keys[section]
-    }
+//    func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
+//        return keys[section]
+//    }
+
+	func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
+		var header = tableView.dequeueReusableHeaderFooterView(withIdentifier: "header")
+		if header == nil{
+			header = UITableViewHeaderFooterView(reuseIdentifier: "header")
+			let label = UILabel()
+			label.tag = 1000
+			label.text = keys[section]
+			label.font = UIFont.systemFont(ofSize: 14, weight: .medium)
+			label.textColor = .black.withAlphaComponent(0.79)
+			header?.contentView.addSubview(label)
+			label.snp.makeConstraints { make in
+				make.left.equalTo(14)
+				make.centerY.equalToSuperview()
+			}
+		}
+			if let label = header?.contentView.viewWithTag(1000) as? UILabel{
+				label.text = keys[section]
+			}
+		return header
+	}
 
     func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
         return 35
@@ -152,14 +173,29 @@
     }
 
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
-        let cell = tableView.dequeueReusableCell(withIdentifier: "_CommonSingleTCell") as! CommonSingleTCell
-        if let model = dataDict[keys[indexPath.section]]?[indexPath.row]{
-            cell.label_title.text = model.name
-        }
-        cell.img_select.isHidden = true
-        cell.view_container.borderColor = .clear
-        cell.view_container.backgroundColor = .white
-        return cell
+        var cell = tableView.dequeueReusableCell(withIdentifier: "_citySingleTCell")
+		if cell == nil{
+			cell = UITableViewCell(style: .default, reuseIdentifier: "_citySingleTCell")
+			let label = UILabel()
+			label.tag = 1000
+			label.text = keys[indexPath.section]
+			label.font = UIFont.systemFont(ofSize: 14, weight: .medium)
+			label.textColor = .black.withAlphaComponent(0.80)
+			cell?.contentView.addSubview(label)
+			label.snp.makeConstraints { make in
+				make.left.equalTo(14)
+				make.centerY.equalToSuperview()
+			}
+		}
+
+
+		if let label = cell!.contentView.viewWithTag(1000) as? UILabel{
+			if let model = dataDict[keys[indexPath.section]]?[indexPath.row]{
+				label.text = model.name
+			}
+		}
+
+        return cell!
     }
 
     func numberOfSections(in tableView: UITableView) -> Int {

--
Gitblit v1.7.1