ProgramCheckViewController.swift
3.01 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
//
// ProgramCheckViewController.swift
// ParentAssistant
//
// Created by Cao yang on 2018/4/11.
// Copyright © 2018年 HANGZHOUTEAM. All rights reserved.
//
import UIKit
class ProgramCheckViewController: UIViewController,UITableViewDelegate,UITableViewDataSource {
lazy var tableView = {()-> UITableView in
let table = UITableView.init(frame: CGRect.init(x: 0, y: 0, width: screenWidth, height: screenHeight-44-22))
table.backgroundColor = backGroundColor
table.delegate = self
table.dataSource = self
table.tableFooterView = UIView.init()
table.separatorStyle = .none
table.register(UINib.init(nibName: "GrowCheckUpTableViewCell", bundle: nil), forCellReuseIdentifier: "GrowCheckUpTableViewCell")
table.register(UINib.init(nibName: "GrowCheckDownTableViewCell", bundle: nil), forCellReuseIdentifier: "GrowCheckDownTableViewCell")
return table
}()
override func viewDidLoad() {
super.viewDidLoad()
self.view.addSubview(self.tableView)
// Do any additional setup after loading the view.
downLoadDataFromNet()
}
/// 获取数据
private func downLoadDataFromNet(){
let params = ["studentid":185,"schoolid":1,"starttime":"2017-07-19"] as [String : Any]
HTTPServer.shared.getStudentCheckList(parameters: params as [String : AnyObject]) { (backData, error) in
print(backData!)
if error == nil && JSON.fromString(backData)!["status"].intValue == 1 {
}
}
}
//MARK: - TableView Delegate && DataSource
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.row == 0 {
return 120
}else{
return 160
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "GrowCheckUpTableViewCell", for: indexPath) as! GrowCheckUpTableViewCell
return cell
}else{
let cell = tableView.dequeueReusableCell(withIdentifier: "GrowCheckDownTableViewCell", for: indexPath) as! GrowCheckDownTableViewCell
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.
}
*/
}