无故事王国
2023-10-16 54e863346e9c246d199c7684e506de4f7437b3bb
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 {