SceneDetailViewController.swift
3.12 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
//
// SceneDetailViewController.swift
// ParentAssistant
//
// Created by Cao yang on 2018/3/22.
// Copyright © 2018年 HANGZHOUTEAM. All rights reserved.
//
import UIKit
class SceneDetailViewController: UIViewController,UITableViewDataSource,UITableViewDelegate {
lazy var sceneTableView = {()->UITableView in
let table = UITableView.init(frame: self.view.bounds)
table.backgroundColor = backGroundColor
table.delegate = self
table.dataSource = self
table.separatorStyle = UITableViewCellSeparatorStyle.none
table.register(UINib.init(nibName: "SceneTopCell", bundle: nil), forCellReuseIdentifier: "cultureCell")
table.register(UINib.init(nibName: "SceneMiddleCell", bundle: nil), forCellReuseIdentifier: "scoreCell")
table.register(UINib.init(nibName: "SceneDownCell", bundle: nil), forCellReuseIdentifier: "disciplineCell")
return table
}()
override func viewDidLoad() {
super.viewDidLoad()
self.title = "场景详情"
self.view.backgroundColor = backGroundColor
self.view.addSubview(self.sceneTableView)
sceneTableView.snp.makeConstraints { (maker) in
maker.width.equalToSuperview()
maker.bottom.equalToSuperview()
maker.top.equalToSuperview()
maker.centerX.equalToSuperview()
}
}
func numberOfSections(in tableView: UITableView) -> Int {
return 3
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 2 {
return 5
}
return 1
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
switch indexPath.section {
case 0:
return 240
case 1:
return screenWidth*0.62
case 2:
return 70
default:
return 0
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var cell = UITableViewCell.init()
switch indexPath.section {
case 0:
cell = tableView.dequeueReusableCell(withIdentifier: "cultureCell", for: indexPath) as! SceneTopCell
return cell
case 1:
cell = tableView.dequeueReusableCell(withIdentifier: "scoreCell", for: indexPath) as! SceneMiddleCell
return cell
case 2:
cell = tableView.dequeueReusableCell(withIdentifier: "disciplineCell", for: indexPath) as! SceneDownCell
return cell
default:
return cell
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}