Commit 287ec07c authored by Steven杜宇's avatar Steven杜宇

// 续签

parent c10679f4
......@@ -83,7 +83,9 @@ extension YHResignMaterialListVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if 0 <= section && section < items.count {
let list = items[section]
return list.materials.count
if list.isUnfold {
return list.materials.count
}
}
return 0
}
......@@ -156,36 +158,51 @@ extension YHResignMaterialListVC: UITableViewDelegate, UITableViewDataSource {
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
let titleLabel = UILabel()
titleLabel.font = UIFont.PFSC_R(ofSize: 15)
titleLabel.textColor = .mainTextColor
view.addSubview(titleLabel)
view.tag = section
if 0 <= section && section < items.count {
let titleLabel = UILabel()
titleLabel.font = UIFont.PFSC_R(ofSize: 15)
titleLabel.textColor = .mainTextColor
view.addSubview(titleLabel)
let info = items[section]
titleLabel.text = info.title
let img = info.isUnfold ? "resign_material_list_unfold" : "resign_material_list_fold"
let arrowImgV = UIImageView(image: UIImage(named: img))
view.addSubview(arrowImgV)
let tap = UITapGestureRecognizer(target: self, action: #selector(didClickSection(_ :)))
view.addGestureRecognizer(tap)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(16)
make.top.equalTo(section == 0 ? 20.0 : 16.0)
make.right.equalTo(arrowImgV.snp.left)
make.bottom.equalTo(-16)
}
arrowImgV.snp.makeConstraints { make in
make.width.height.equalTo(21.0)
make.right.equalTo(-16)
make.top.equalTo(titleLabel)
}
}
let img = isUnfold ? "resign_material_list_unfold" : "resign_material_list_fold"
let arrowImgV = UIImageView(image: UIImage(named: img))
view.addSubview(arrowImgV)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(16)
make.top.equalTo(section == 0 ? 20.0 : 16.0)
make.right.equalTo(arrowImgV.snp.left)
make.bottom.equalTo(-16)
}
arrowImgV.snp.makeConstraints { make in
make.width.height.equalTo(21.0)
make.right.equalTo(-16)
make.top.equalTo(titleLabel)
}
return view
}
@objc func didClickSection(_ gesture: UIGestureRecognizer) {
if let section = gesture.view?.tag {
if 0 <= section && section < items.count {
let info = items[section]
info.isUnfold = !info.isUnfold
self.tableView.reloadData()
}
}
}
}
......
......@@ -12,6 +12,8 @@ class YHResignMaterialInfo {
var title: String = ""
var materials: [YHMaterialModel] = []
// 是否展开 默认展开
var isUnfold: Bool = true
init(title: String, materials: [YHMaterialModel]) {
self.title = title
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment