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

// 续签

parent c10679f4
...@@ -83,8 +83,10 @@ extension YHResignMaterialListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -83,8 +83,10 @@ extension YHResignMaterialListVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if 0 <= section && section < items.count { if 0 <= section && section < items.count {
let list = items[section] let list = items[section]
if list.isUnfold {
return list.materials.count return list.materials.count
} }
}
return 0 return 0
} }
...@@ -156,21 +158,26 @@ extension YHResignMaterialListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -156,21 +158,26 @@ extension YHResignMaterialListVC: UITableViewDelegate, UITableViewDataSource {
} }
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView() let view = UIView()
view.tag = section
if 0 <= section && section < items.count {
let titleLabel = UILabel() let titleLabel = UILabel()
titleLabel.font = UIFont.PFSC_R(ofSize: 15) titleLabel.font = UIFont.PFSC_R(ofSize: 15)
titleLabel.textColor = .mainTextColor titleLabel.textColor = .mainTextColor
view.addSubview(titleLabel) view.addSubview(titleLabel)
if 0 <= section && section < items.count {
let info = items[section] let info = items[section]
titleLabel.text = info.title titleLabel.text = info.title
} let img = info.isUnfold ? "resign_material_list_unfold" : "resign_material_list_fold"
let img = isUnfold ? "resign_material_list_unfold" : "resign_material_list_fold"
let arrowImgV = UIImageView(image: UIImage(named: img)) let arrowImgV = UIImageView(image: UIImage(named: img))
view.addSubview(arrowImgV) view.addSubview(arrowImgV)
let tap = UITapGestureRecognizer(target: self, action: #selector(didClickSection(_ :)))
view.addGestureRecognizer(tap)
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
make.left.equalTo(16) make.left.equalTo(16)
make.top.equalTo(section == 0 ? 20.0 : 16.0) make.top.equalTo(section == 0 ? 20.0 : 16.0)
...@@ -183,9 +190,19 @@ extension YHResignMaterialListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -183,9 +190,19 @@ extension YHResignMaterialListVC: UITableViewDelegate, UITableViewDataSource {
make.right.equalTo(-16) make.right.equalTo(-16)
make.top.equalTo(titleLabel) make.top.equalTo(titleLabel)
} }
}
return view 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 { ...@@ -12,6 +12,8 @@ class YHResignMaterialInfo {
var title: String = "" var title: String = ""
var materials: [YHMaterialModel] = [] var materials: [YHMaterialModel] = []
// 是否展开 默认展开
var isUnfold: Bool = true
init(title: String, materials: [YHMaterialModel]) { init(title: String, materials: [YHMaterialModel]) {
self.title = title 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