CNLiveMineQuestViewController.swift
4.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//
// CNLiveMineQuestViewController.swift
// metaCode
//
// Created by open on 2023/6/26.
//
import Foundation
class CNLiveMineQuestViewController: CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource {
let kMineBodyFourViewCellIdentifier = "kMineBodyFourViewCellIdentifier"
lazy var tableView: UITableView = {
let tableView = UITableView.init(frame: .zero, style: .plain)
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.register(MineBodyFourViewCell.self, forCellReuseIdentifier: kMineBodyFourViewCellIdentifier)
tableView.tableHeaderView = MineQuestHeaderView.init(frame: CGRectMake(0, 10, KSreenWidth, 150))
let footerView = UIView(frame: CGRect(x: 0, y: 0, width: KSreenWidth - 40, height: 10))
footerView.clipsToBounds = true
footerView.backgroundColor = .white
footerView.addCorner(conrners: [.bottomLeft,.bottomRight], radius: 5)
tableView.tableFooterView = footerView
return tableView
}()
lazy var headerView: UIView = {
let headerView = UIView.init(frame: CGRectMake(0, 0, KSreenWidth - 40, 60))
headerView.backgroundColor = .white
headerView.addCorner(conrners: [.topLeft,.topRight], radius: 10)
headerView.layer.masksToBounds = true
let nameLabel = UILabel.init()
nameLabel.text = "日常任务"
nameLabel.textColor = .black
nameLabel.textAlignment = .left
nameLabel.font = BoldFont_19_Fit
headerView.addSubview(nameLabel)
nameLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(10)
}
let lineLabel = UILabel.init()
lineLabel.backgroundColor = HexColor("#E5E5E5")
headerView.addSubview(lineLabel)
lineLabel.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.bottom.equalToSuperview().offset(-0.5)
make.left.equalToSuperview().offset(15)
make.right.equalToSuperview().offset(-15)
make.height.equalTo(0.5)
}
return headerView
}()
lazy var dataArray: NSMutableArray = {
let dataArray = NSMutableArray.init()
dataArray.add(["icon":"temp_quest_list_img01","name":"分享目击者视频","desc":"积分值+100 完成0/10"])
dataArray.add(["icon":"temp_quest_list_img02","name":"分享目击者视频","desc":"积分值+100 完成0/10"])
dataArray.add(["icon":"temp_quest_list_img03","name":"分享目击者视频","desc":"积分值+100 完成0/10"])
dataArray.add(["icon":"temp_quest_list_img04","name":"分享目击者视频","desc":"积分值+100 完成0/10"])
return dataArray
}()
override func viewDidLoad() {
super.viewDidLoad()
navigationBarHidden = false
titleName = "任务中心"
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(KNavigationHeight)
make.bottom.equalToSuperview().offset(KTabBarHeight - 49)
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
}
}
}
extension CNLiveMineQuestViewController {
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return dataArray.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: kMineBodyFourViewCellIdentifier) as? MineBodyFourViewCell else {
return MineBodyFourViewCell()
}
cell.setupWithData(dict: dataArray[indexPath.row] as! NSDictionary)
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 70.0
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 60.0
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return headerView
}
}