Commit 6f4faf3dd1363a75946a4c3d6a240d7695be5d86
1 parent
913c6d04
Exists in
parentassistant
添加日历控件
Showing
5 changed files
with
195 additions
and
175 deletions
Show diff stats
ParentAssistant/ParentAssistant.xcodeproj/project.pbxproj
@@ -43,6 +43,7 @@ | @@ -43,6 +43,7 @@ | ||
43 | ADAEA3982064960300A47D2C /* SceneDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADAEA3972064960300A47D2C /* SceneDetailViewController.swift */; }; | 43 | ADAEA3982064960300A47D2C /* SceneDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADAEA3972064960300A47D2C /* SceneDetailViewController.swift */; }; |
44 | ADAEA39A2064C44900A47D2C /* LineChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADAEA3992064C44900A47D2C /* LineChartView.swift */; }; | 44 | ADAEA39A2064C44900A47D2C /* LineChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADAEA3992064C44900A47D2C /* LineChartView.swift */; }; |
45 | ADE33B312062202300BEA6E6 /* Macro.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADE33B302062202300BEA6E6 /* Macro.swift */; }; | 45 | ADE33B312062202300BEA6E6 /* Macro.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADE33B302062202300BEA6E6 /* Macro.swift */; }; |
46 | + ADF159612069E00000A9485D /* CalendarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADF159602069E00000A9485D /* CalendarView.swift */; }; | ||
46 | BF388469205A4DE900A240EF /* StudentClassInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF388468205A4DE900A240EF /* StudentClassInfo.swift */; }; | 47 | BF388469205A4DE900A240EF /* StudentClassInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF388468205A4DE900A240EF /* StudentClassInfo.swift */; }; |
47 | BF38846C205A58F800A240EF /* YXMessageManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF38846B205A58F800A240EF /* YXMessageManager.swift */; }; | 48 | BF38846C205A58F800A240EF /* YXMessageManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF38846B205A58F800A240EF /* YXMessageManager.swift */; }; |
48 | BF38846E205A5A0000A240EF /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF38846D205A59FE00A240EF /* MobileCoreServices.framework */; }; | 49 | BF38846E205A5A0000A240EF /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF38846D205A59FE00A240EF /* MobileCoreServices.framework */; }; |
@@ -188,6 +189,7 @@ | @@ -188,6 +189,7 @@ | ||
188 | ADAEA3972064960300A47D2C /* SceneDetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SceneDetailViewController.swift; sourceTree = "<group>"; }; | 189 | ADAEA3972064960300A47D2C /* SceneDetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SceneDetailViewController.swift; sourceTree = "<group>"; }; |
189 | ADAEA3992064C44900A47D2C /* LineChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineChartView.swift; sourceTree = "<group>"; }; | 190 | ADAEA3992064C44900A47D2C /* LineChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineChartView.swift; sourceTree = "<group>"; }; |
190 | ADE33B302062202300BEA6E6 /* Macro.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Macro.swift; sourceTree = "<group>"; }; | 191 | ADE33B302062202300BEA6E6 /* Macro.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Macro.swift; sourceTree = "<group>"; }; |
192 | + ADF159602069E00000A9485D /* CalendarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarView.swift; sourceTree = "<group>"; }; | ||
191 | BF388468205A4DE900A240EF /* StudentClassInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StudentClassInfo.swift; sourceTree = "<group>"; }; | 193 | BF388468205A4DE900A240EF /* StudentClassInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StudentClassInfo.swift; sourceTree = "<group>"; }; |
192 | BF38846B205A58F800A240EF /* YXMessageManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YXMessageManager.swift; sourceTree = "<group>"; }; | 194 | BF38846B205A58F800A240EF /* YXMessageManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YXMessageManager.swift; sourceTree = "<group>"; }; |
193 | BF38846D205A59FE00A240EF /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; | 195 | BF38846D205A59FE00A240EF /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; |
@@ -514,6 +516,7 @@ | @@ -514,6 +516,7 @@ | ||
514 | isa = PBXGroup; | 516 | isa = PBXGroup; |
515 | children = ( | 517 | children = ( |
516 | BF3B829F2050CC8B002078EA /* ReportHeaderView.swift */, | 518 | BF3B829F2050CC8B002078EA /* ReportHeaderView.swift */, |
519 | + ADF159602069E00000A9485D /* CalendarView.swift */, | ||
517 | BF3B82A32050DA75002078EA /* ReportHeaderView.xib */, | 520 | BF3B82A32050DA75002078EA /* ReportHeaderView.xib */, |
518 | BFEAAAA8205248AC0072FAAF /* TaskPresentationTableViewCell.swift */, | 521 | BFEAAAA8205248AC0072FAAF /* TaskPresentationTableViewCell.swift */, |
519 | BFEAAAAA205249B50072FAAF /* ReportDateCollectionViewCell.swift */, | 522 | BFEAAAAA205249B50072FAAF /* ReportDateCollectionViewCell.swift */, |
@@ -979,6 +982,7 @@ | @@ -979,6 +982,7 @@ | ||
979 | BFEAAAC4205257460072FAAF /* LXCalendarMonthModel.m in Sources */, | 982 | BFEAAAC4205257460072FAAF /* LXCalendarMonthModel.m in Sources */, |
980 | BF38847E205CDE2D00A240EF /* JSViewController.swift in Sources */, | 983 | BF38847E205CDE2D00A240EF /* JSViewController.swift in Sources */, |
981 | ADE33B312062202300BEA6E6 /* Macro.swift in Sources */, | 984 | ADE33B312062202300BEA6E6 /* Macro.swift in Sources */, |
985 | + ADF159612069E00000A9485D /* CalendarView.swift in Sources */, | ||
982 | BF406CD82057B529000A6681 /* MessageTableViewCell.swift in Sources */, | 986 | BF406CD82057B529000A6681 /* MessageTableViewCell.swift in Sources */, |
983 | 599364EC204E62E700C8B371 /* EvaluationViewController.swift in Sources */, | 987 | 599364EC204E62E700C8B371 /* EvaluationViewController.swift in Sources */, |
984 | 599364F0204E62E700C8B371 /* ReportViewController.swift in Sources */, | 988 | 599364F0204E62E700C8B371 /* ReportViewController.swift in Sources */, |
ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
ParentAssistant/ParentAssistant/Classes/controllers/report/ReportViewController.swift
@@ -11,11 +11,17 @@ import UIKit | @@ -11,11 +11,17 @@ import UIKit | ||
11 | class ReportViewController: UIViewController { | 11 | class ReportViewController: UIViewController { |
12 | var titleView:ReportHeaderView!//navigationBar自定义view | 12 | var titleView:ReportHeaderView!//navigationBar自定义view |
13 | @IBOutlet weak var reportTable: UITableView! | 13 | @IBOutlet weak var reportTable: UITableView! |
14 | - @IBOutlet var dateViewHeight: NSLayoutConstraint!//顶部固定日期的高度 | ||
15 | -// @IBOutlet var calendarView: UIView! | 14 | + //空白页 |
16 | var EmptyView: UIView! | 15 | var EmptyView: UIView! |
17 | - var dateView:LXCalendarView! | ||
18 | - var dateAry:(weeks:[String],days:[String]) = ([],[]) | 16 | + |
17 | + //膜板 | ||
18 | + var keyWindow = UIWindow() | ||
19 | + var backBotton = UIButton() | ||
20 | + //日历 | ||
21 | + var calendar = CalendarView() | ||
22 | + | ||
23 | +// var dateAry:(weeks:[String],days:[String]) = ([],[]) | ||
24 | + | ||
19 | override func viewDidLoad() { | 25 | override func viewDidLoad() { |
20 | super.viewDidLoad() | 26 | super.viewDidLoad() |
21 | 27 | ||
@@ -33,7 +39,7 @@ class ReportViewController: UIViewController { | @@ -33,7 +39,7 @@ class ReportViewController: UIViewController { | ||
33 | //设置顶部按钮 | 39 | //设置顶部按钮 |
34 | setupNavigationBar() | 40 | setupNavigationBar() |
35 | //设置日期页面 | 41 | //设置日期页面 |
36 | -// setupDateView() | 42 | + setupDateView() |
37 | } | 43 | } |
38 | } | 44 | } |
39 | // MARK: - 设置顶部按钮 | 45 | // MARK: - 设置顶部按钮 |
@@ -42,61 +48,72 @@ class ReportViewController: UIViewController { | @@ -42,61 +48,72 @@ class ReportViewController: UIViewController { | ||
42 | let backImage = UIImage(named: "navigationBar_backgrounImage") | 48 | let backImage = UIImage(named: "navigationBar_backgrounImage") |
43 | self.navigationController?.navigationBar.setBackgroundImage(backImage, for: UIBarMetrics.default) | 49 | self.navigationController?.navigationBar.setBackgroundImage(backImage, for: UIBarMetrics.default) |
44 | self.configTheme() | 50 | self.configTheme() |
45 | - self.navigationItem.title = "报告" | 51 | +// self.navigationItem.title = "报告" |
46 | setuptitleView() | 52 | setuptitleView() |
47 | 53 | ||
48 | } | 54 | } |
49 | func setuptitleView(){ | 55 | func setuptitleView(){ |
50 | - // MARK: - 设置顶部的titleView | ||
51 | - titleView = Bundle.main.loadNibNamed("ReportHeaderView", owner: nil, options: nil)![0] as! ReportHeaderView | ||
52 | - titleView.delegate = self | ||
53 | - titleView.frame = CGRect(x: 0, y: 0, width: screenWidth, height: 44) | ||
54 | - self.navigationItem.titleView = titleView | ||
55 | - titleView.layoutSubviews() | ||
56 | - //navigation左上角显示名称 家长未绑定孩子 | ||
57 | - if AccountManager.shared.isOnline() { | ||
58 | - if AccountManager.shared.rawUserInfo!.contentData()["studentClass"].arrayValue.count == 0 { | ||
59 | - titleView.nameButton.setTitle("未绑定", for: UIControlState.normal) | ||
60 | - }else{ | ||
61 | - titleView.nameButton.setTitle(AccountManager.shared.rawUserInfo!.contentData()["studentClass"][0]["studentName"].stringValue, for: UIControlState.normal) | ||
62 | - } | ||
63 | - }else{ | ||
64 | - titleView.nameButton.setTitle("未登录", for: UIControlState.normal) | ||
65 | - } | 56 | + |
57 | + | ||
58 | +// // MARK: - 设置顶部的titleView | ||
59 | +// titleView = Bundle.main.loadNibNamed("ReportHeaderView", owner: nil, options: nil)![0] as! ReportHeaderView | ||
60 | +//// titleView.delegate = self | ||
61 | +// titleView.frame = CGRect(x: 0, y: 0, width: screenWidth, height: 44) | ||
62 | +// self.navigationItem.titleView = titleView | ||
63 | +// titleView.layoutSubviews() | ||
64 | +// //navigation左上角显示名称 家长未绑定孩子 | ||
65 | +// if AccountManager.shared.isOnline() { | ||
66 | +// if AccountManager.shared.rawUserInfo!.contentData()["studentClass"].arrayValue.count == 0 { | ||
67 | +// titleView.nameButton.setTitle("未绑定", for: UIControlState.normal) | ||
68 | +// }else{ | ||
69 | +// titleView.nameButton.setTitle(AccountManager.shared.rawUserInfo!.contentData()["studentClass"][0]["studentName"].stringValue, for: UIControlState.normal) | ||
70 | +// } | ||
71 | +// }else{ | ||
72 | +// titleView.nameButton.setTitle("未登录", for: UIControlState.normal) | ||
73 | +// } | ||
66 | } | 74 | } |
67 | // MARK: - 设置日期页面 | 75 | // MARK: - 设置日期页面 |
68 | func setupDateView(){ | 76 | func setupDateView(){ |
69 | -// titleView.dateButton.setTitle("\(getCurrentDate())", for: UIControlState.normal) | ||
70 | -// dateViewHeight.constant = getScreenWidth()/7 | ||
71 | -// //添加顶部固定一周日期 | ||
72 | -// dateAry = getCurrentWeeks() | ||
73 | -// //添加日历 | ||
74 | -// dateView = LXCalendarView(frame: CGRect(x: 0, y: 0, width: screenWidth, height: screenWidth/2)) | ||
75 | -// dateView.isHaveAnimation = true | ||
76 | -// dateView.isCanScroll = true | ||
77 | -// dateView.isShowLastAndNextBtn = false | ||
78 | -// dateView.isShowLastAndNextDate = true | ||
79 | -// | ||
80 | -// dateView.todayTitleColor = UIColor.red | ||
81 | -// dateView.selectBackColor = UIColorFromRGB(0xC5DAFF) | ||
82 | -// dateView.dealData() | ||
83 | -// dateView.backgroundColor = UIColor.white | ||
84 | -// calendarView.addSubview(dateView) | ||
85 | -// dateView.selectBlock = { (year:NSInteger,month:NSInteger,day:NSInteger) -> () in | ||
86 | -// self.calendarView.isHidden = true | ||
87 | -// self.titleView.dateButton.setTitle("\(month)月\(day)日", for: UIControlState.normal) | ||
88 | -// //选择日期后应隐藏日历并刷新界面 | ||
89 | -// appDelegate.window!.makeToast("\(year)年\(month)月\(day)日", duration: 2, position: CSToastPositionCenter) | ||
90 | -// | ||
91 | -// } | 77 | + |
78 | + let headView = UIView.init(frame: CGRect.init(x: 0, y: 0, width: screenWidth, height: 60)) | ||
79 | + self.view.addSubview(headView) | ||
80 | + | ||
81 | + //添加手势 | ||
82 | + let recognizer = UISwipeGestureRecognizer.init(target: self, action: #selector(showView)) | ||
83 | + recognizer.direction = UISwipeGestureRecognizerDirection.down | ||
84 | + headView.addGestureRecognizer(recognizer) | ||
85 | + | ||
86 | + calendar = CalendarView.init(frame: CGRect.init(x: 0, y: 30, width: screenWidth, height: 260)) | ||
87 | + } | ||
88 | + | ||
89 | + @objc func showView(){ | ||
90 | + keyWindow = UIApplication.shared.keyWindow! | ||
91 | + let backBtn = UIButton.init(frame: CGRect.init(x: 0, y: calendar.frame.origin.y+260+22, width: screenWidth, height: screenHeight)) | ||
92 | + backBtn.backgroundColor = UIColor.black | ||
93 | + backBtn.alpha = 0.4 | ||
94 | + | ||
95 | + backBtn.addTarget(self, action: #selector(closeView(btn:)), for: UIControlEvents.allEvents) | ||
96 | + reportTable.isUserInteractionEnabled = false | ||
97 | + | ||
98 | + keyWindow.addSubview(backBtn) | ||
99 | + keyWindow.addSubview(calendar) | ||
100 | + calendar.isHidden = false | ||
101 | + } | ||
102 | + @objc func closeView(btn:UIButton) { | ||
103 | + | ||
104 | + reportTable.isUserInteractionEnabled = true | ||
105 | + UIView.animate(withDuration: 0.3) { | ||
106 | + btn.removeFromSuperview() | ||
107 | + self.calendar.isHidden = true | ||
108 | + } | ||
92 | } | 109 | } |
110 | + | ||
93 | // MARK: - 页面将要显示时替换navigation的titleView | 111 | // MARK: - 页面将要显示时替换navigation的titleView |
94 | override func viewWillAppear(_ animated: Bool) { | 112 | override func viewWillAppear(_ animated: Bool) { |
95 | super.viewWillAppear(animated) | 113 | super.viewWillAppear(animated) |
96 | } | 114 | } |
97 | override func viewWillDisappear(_ animated: Bool) { | 115 | override func viewWillDisappear(_ animated: Bool) { |
98 | super.viewWillDisappear(animated) | 116 | super.viewWillDisappear(animated) |
99 | -// self.calendarView.isHidden = true | ||
100 | } | 117 | } |
101 | override func viewDidLayoutSubviews() { | 118 | override func viewDidLayoutSubviews() { |
102 | super.viewDidLayoutSubviews() | 119 | super.viewDidLayoutSubviews() |
@@ -111,66 +128,59 @@ class ReportViewController: UIViewController { | @@ -111,66 +128,59 @@ class ReportViewController: UIViewController { | ||
111 | 128 | ||
112 | } | 129 | } |
113 | // MARK: - 点击顶部titleView按钮的代理方法 | 130 | // MARK: - 点击顶部titleView按钮的代理方法 |
114 | -extension ReportViewController: ReportHeaderViewDelegate{ | ||
115 | - //点击孩子姓名 | ||
116 | - func selectStudentButton() { | ||
117 | - appDelegate.window!.makeToast("该功能暂不开放", duration: 1, position: CSToastPositionCenter) | ||
118 | - return | ||
119 | - //如果家长未绑定孩子 | ||
120 | - if AccountManager.shared.isOnline() { | ||
121 | - if AccountManager.shared.rawUserInfo!.contentData()["studentClass"].arrayValue.count == 0 { | ||
122 | - appDelegate.window!.makeToast("请先绑定孩子", duration: 1, position: CSToastPositionCenter) | ||
123 | - }else{ | ||
124 | - //切换孩子 | ||
125 | - let alert = UIAlertController(title: "切换孩子", message: "", preferredStyle: UIAlertControllerStyle.actionSheet) | ||
126 | - for item in AccountManager.shared.rawUserInfo!.contentData()["studentClass"].arrayValue { | ||
127 | - let action = UIAlertAction(title: item["studentName"].stringValue, style: UIAlertActionStyle.default, handler: { (action) in | ||
128 | - //选择完孩子切换数据 | ||
129 | - }) | ||
130 | - alert.addAction(action) | ||
131 | - } | ||
132 | - self.present(alert, animated: true, completion: nil) | ||
133 | - } | ||
134 | - }else{ | ||
135 | - appDelegate.window!.makeToast("请先登录", duration: 1, position: CSToastPositionCenter) | ||
136 | - } | ||
137 | - } | ||
138 | - //点击日期 | ||
139 | - func selectDateButton() { | ||
140 | - | ||
141 | - appDelegate.window!.makeToast("该功能暂不开放", duration: 1, position: CSToastPositionCenter) | ||
142 | - return | ||
143 | - | ||
144 | -// let isHidden = calendarView.isHidden | ||
145 | -// if isHidden { | ||
146 | -// calendarView.isHidden = false | 131 | +//extension ReportViewController: ReportHeaderViewDelegate{ |
132 | +// //点击孩子姓名 | ||
133 | +// func selectStudentButton() { | ||
134 | +// appDelegate.window!.makeToast("该功能暂不开放", duration: 1, position: CSToastPositionCenter) | ||
135 | +// return | ||
136 | +// //如果家长未绑定孩子 | ||
137 | +// if AccountManager.shared.isOnline() { | ||
138 | +// if AccountManager.shared.rawUserInfo!.contentData()["studentClass"].arrayValue.count == 0 { | ||
139 | +// appDelegate.window!.makeToast("请先绑定孩子", duration: 1, position: CSToastPositionCenter) | ||
140 | +// }else{ | ||
141 | +// //切换孩子 | ||
142 | +// let alert = UIAlertController(title: "切换孩子", message: "", preferredStyle: UIAlertControllerStyle.actionSheet) | ||
143 | +// for item in AccountManager.shared.rawUserInfo!.contentData()["studentClass"].arrayValue { | ||
144 | +// let action = UIAlertAction(title: item["studentName"].stringValue, style: UIAlertActionStyle.default, handler: { (action) in | ||
145 | +// //选择完孩子切换数据 | ||
146 | +// }) | ||
147 | +// alert.addAction(action) | ||
148 | +// } | ||
149 | +// self.present(alert, animated: true, completion: nil) | ||
150 | +// } | ||
147 | // }else{ | 151 | // }else{ |
148 | -// calendarView.isHidden = true | 152 | +// appDelegate.window!.makeToast("请先登录", duration: 1, position: CSToastPositionCenter) |
149 | // } | 153 | // } |
150 | - } | ||
151 | - //点击筛选 | ||
152 | - func selectTypeButton() { | ||
153 | - appDelegate.window!.makeToast("该功能暂不开放", duration: 1, position: CSToastPositionCenter) | ||
154 | - return | ||
155 | - } | ||
156 | -} | ||
157 | -// MARK: - 顶部展示日期 | ||
158 | -extension ReportViewController: UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout { | ||
159 | - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { | ||
160 | - return CGSize(width: getScreenWidth()/7, height: getScreenWidth()/7) | ||
161 | - } | ||
162 | - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { | ||
163 | - return 0 | ||
164 | - } | ||
165 | - | ||
166 | - func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { | ||
167 | - let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ReportDateCollectionViewCell", for: indexPath) as! ReportDateCollectionViewCell | ||
168 | - cell.setupWithDate(week: dateAry.weeks[indexPath.row], date: dateAry.days[indexPath.row]) | ||
169 | - return cell | ||
170 | - } | ||
171 | - | ||
172 | - | ||
173 | -} | 154 | +// } |
155 | +// //点击日期 | ||
156 | +// func selectDateButton() { | ||
157 | +// | ||
158 | +// appDelegate.window!.makeToast("该功能暂不开放", duration: 1, position: CSToastPositionCenter) | ||
159 | +// return | ||
160 | +// } | ||
161 | +// //点击筛选 | ||
162 | +// func selectTypeButton() { | ||
163 | +// appDelegate.window!.makeToast("该功能暂不开放", duration: 1, position: CSToastPositionCenter) | ||
164 | +// return | ||
165 | +// } | ||
166 | +//} | ||
167 | +//// MARK: - 顶部展示日期 | ||
168 | +//extension ReportViewController: UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout { | ||
169 | +// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { | ||
170 | +// return CGSize(width: getScreenWidth()/7, height: getScreenWidth()/7) | ||
171 | +// } | ||
172 | +// func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { | ||
173 | +// return 0 | ||
174 | +// } | ||
175 | +// | ||
176 | +// func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { | ||
177 | +// let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ReportDateCollectionViewCell", for: indexPath) as! ReportDateCollectionViewCell | ||
178 | +// cell.setupWithDate(week: dateAry.weeks[indexPath.row], date: dateAry.days[indexPath.row]) | ||
179 | +// return cell | ||
180 | +// } | ||
181 | +// | ||
182 | +// | ||
183 | +//} | ||
174 | // MARK: - 作业报告列表 | 184 | // MARK: - 作业报告列表 |
175 | extension ReportViewController: UITableViewDelegate,UITableViewDataSource{ | 185 | extension ReportViewController: UITableViewDelegate,UITableViewDataSource{ |
176 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | 186 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { |
ParentAssistant/ParentAssistant/Classes/controllers/report/View/CalendarView.swift
0 → 100644
@@ -0,0 +1,72 @@ | @@ -0,0 +1,72 @@ | ||
1 | +// | ||
2 | +// CalendarView.swift | ||
3 | +// ParentAssistant | ||
4 | +// | ||
5 | +// Created by Cao yang on 2018/3/27. | ||
6 | +// Copyright © 2018年 HANGZHOUTEAM. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +import UIKit | ||
10 | + | ||
11 | +class CalendarView: UIView,UICollectionViewDelegate,UICollectionViewDataSource { | ||
12 | + | ||
13 | + | ||
14 | + var weekLab = ["日","一","二","三","四","五","六"] | ||
15 | + | ||
16 | + override init(frame: CGRect) { | ||
17 | + super.init(frame: frame) | ||
18 | + self.drawCalendarView(frame: frame) | ||
19 | + } | ||
20 | + | ||
21 | + func drawCalendarView(frame:CGRect) { | ||
22 | + //TODO: 数据源待完成 | ||
23 | + let dayLab = ["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"] | ||
24 | + weekLab.append(contentsOf: dayLab) | ||
25 | + //设置layout | ||
26 | + let flowlayout = UICollectionViewFlowLayout() | ||
27 | + flowlayout.itemSize = CGSize.init(width: screenWidth/7, height:40) | ||
28 | + flowlayout.minimumLineSpacing = 0 | ||
29 | + flowlayout.minimumInteritemSpacing = 0 | ||
30 | + flowlayout.headerReferenceSize = CGSize.init(width: 0, height: 0) | ||
31 | + flowlayout.footerReferenceSize = CGSize.init(width: 0, height: 0) | ||
32 | + flowlayout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0) | ||
33 | + | ||
34 | + let calendarView = UICollectionView.init(frame: frame, collectionViewLayout: flowlayout) | ||
35 | + calendarView.delegate = self | ||
36 | + calendarView.dataSource = self | ||
37 | + calendarView.backgroundColor = UIColor.white | ||
38 | + calendarView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "calendarCell") | ||
39 | + self.addSubview(calendarView) | ||
40 | + } | ||
41 | + | ||
42 | + //MARK: - Delegate | ||
43 | + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { | ||
44 | + return weekLab.count | ||
45 | + } | ||
46 | + | ||
47 | + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { | ||
48 | + | ||
49 | + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "calendarCell", for: indexPath) | ||
50 | + let lab = UILabel.init(frame: cell.bounds) | ||
51 | + lab.text = weekLab[indexPath.row] | ||
52 | + lab.textAlignment = .center | ||
53 | + cell.addSubview(lab) | ||
54 | + return cell | ||
55 | + | ||
56 | + } | ||
57 | + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { | ||
58 | + print("点击了 第 \(weekLab[indexPath.row])") | ||
59 | + } | ||
60 | + required init?(coder aDecoder: NSCoder) { | ||
61 | + fatalError("init(coder:) has not been implemented") | ||
62 | + } | ||
63 | + | ||
64 | + /* | ||
65 | + // Only override draw() if you perform custom drawing. | ||
66 | + // An empty implementation adversely affects performance during animation. | ||
67 | + override func draw(_ rect: CGRect) { | ||
68 | + // Drawing code | ||
69 | + } | ||
70 | + */ | ||
71 | + | ||
72 | +} |
ParentAssistant/ParentAssistant/Supporting Files/Base.lproj/Main.storyboard
@@ -532,70 +532,8 @@ | @@ -532,70 +532,8 @@ | ||
532 | <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | 532 | <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> |
533 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | 533 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
534 | <subviews> | 534 | <subviews> |
535 | - <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="k9z-2G-Fhx"> | ||
536 | - <rect key="frame" x="0.0" y="64" width="375" height="66"/> | ||
537 | - <subviews> | ||
538 | - <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="qrg-1E-cj1"> | ||
539 | - <rect key="frame" x="0.0" y="0.0" width="375" height="74"/> | ||
540 | - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> | ||
541 | - <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | ||
542 | - <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="JEd-qR-M0H"> | ||
543 | - <size key="itemSize" width="72" height="66"/> | ||
544 | - <size key="headerReferenceSize" width="0.0" height="0.0"/> | ||
545 | - <size key="footerReferenceSize" width="0.0" height="0.0"/> | ||
546 | - <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/> | ||
547 | - </collectionViewFlowLayout> | ||
548 | - <cells> | ||
549 | - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="ReportDateCollectionViewCell" id="nWe-hG-7vd" customClass="ReportDateCollectionViewCell" customModule="ParentAssistant" customModuleProvider="target"> | ||
550 | - <rect key="frame" x="0.0" y="0.0" width="72" height="66"/> | ||
551 | - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> | ||
552 | - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO"> | ||
553 | - <rect key="frame" x="0.0" y="0.0" width="72" height="66"/> | ||
554 | - <autoresizingMask key="autoresizingMask"/> | ||
555 | - <subviews> | ||
556 | - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FXs-QS-gp4"> | ||
557 | - <rect key="frame" x="0.0" y="0.0" width="72" height="33"/> | ||
558 | - <fontDescription key="fontDescription" type="system" pointSize="15"/> | ||
559 | - <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | ||
560 | - <nil key="highlightedColor"/> | ||
561 | - </label> | ||
562 | - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YPT-sg-8nw"> | ||
563 | - <rect key="frame" x="0.0" y="33" width="72" height="33"/> | ||
564 | - <fontDescription key="fontDescription" type="system" pointSize="15"/> | ||
565 | - <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | ||
566 | - <nil key="highlightedColor"/> | ||
567 | - </label> | ||
568 | - </subviews> | ||
569 | - </view> | ||
570 | - <constraints> | ||
571 | - <constraint firstItem="YPT-sg-8nw" firstAttribute="leading" secondItem="nWe-hG-7vd" secondAttribute="leading" id="HkR-pZ-Ipo"/> | ||
572 | - <constraint firstItem="FXs-QS-gp4" firstAttribute="top" secondItem="nWe-hG-7vd" secondAttribute="top" id="Oac-9M-ihz"/> | ||
573 | - <constraint firstAttribute="trailing" secondItem="YPT-sg-8nw" secondAttribute="trailing" id="XHq-aJ-fWg"/> | ||
574 | - <constraint firstItem="YPT-sg-8nw" firstAttribute="top" secondItem="FXs-QS-gp4" secondAttribute="bottom" id="aLc-pS-8gY"/> | ||
575 | - <constraint firstItem="FXs-QS-gp4" firstAttribute="leading" secondItem="nWe-hG-7vd" secondAttribute="leading" id="ala-Gh-0Nr"/> | ||
576 | - <constraint firstAttribute="trailing" secondItem="FXs-QS-gp4" secondAttribute="trailing" id="bOL-H5-Mex"/> | ||
577 | - <constraint firstItem="FXs-QS-gp4" firstAttribute="height" secondItem="nWe-hG-7vd" secondAttribute="height" multiplier="1:2" id="eil-wN-3jX"/> | ||
578 | - <constraint firstAttribute="bottom" secondItem="YPT-sg-8nw" secondAttribute="bottom" id="pu1-56-EfG"/> | ||
579 | - </constraints> | ||
580 | - <connections> | ||
581 | - <outlet property="dateLabel" destination="YPT-sg-8nw" id="VMN-zF-vR5"/> | ||
582 | - <outlet property="weekLabel" destination="FXs-QS-gp4" id="tRg-2N-ioR"/> | ||
583 | - </connections> | ||
584 | - </collectionViewCell> | ||
585 | - </cells> | ||
586 | - <connections> | ||
587 | - <outlet property="dataSource" destination="oqH-t7-mJp" id="YKj-Tw-BhH"/> | ||
588 | - <outlet property="delegate" destination="oqH-t7-mJp" id="f7v-II-ZH5"/> | ||
589 | - </connections> | ||
590 | - </collectionView> | ||
591 | - </subviews> | ||
592 | - <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | ||
593 | - <constraints> | ||
594 | - <constraint firstAttribute="height" constant="66" id="38f-Kq-3QN"/> | ||
595 | - </constraints> | ||
596 | - </view> | ||
597 | <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="EEs-Ae-t7U"> | 535 | <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="EEs-Ae-t7U"> |
598 | - <rect key="frame" x="0.0" y="135" width="375" height="483"/> | 536 | + <rect key="frame" x="0.0" y="134" width="375" height="484"/> |
599 | <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/> | 537 | <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/> |
600 | <prototypes> | 538 | <prototypes> |
601 | <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="MoralTableViewCell" rowHeight="280" id="mJ6-p0-1k0" customClass="MoralTableViewCell" customModule="ParentAssistant" customModuleProvider="target"> | 539 | <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="MoralTableViewCell" rowHeight="280" id="mJ6-p0-1k0" customClass="MoralTableViewCell" customModule="ParentAssistant" customModuleProvider="target"> |
@@ -821,19 +759,15 @@ | @@ -821,19 +759,15 @@ | ||
821 | </subviews> | 759 | </subviews> |
822 | <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/> | 760 | <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/> |
823 | <constraints> | 761 | <constraints> |
824 | - <constraint firstItem="EEs-Ae-t7U" firstAttribute="bottom" secondItem="9O4-jf-dgu" secondAttribute="bottom" id="JYY-zh-cHV"/> | ||
825 | - <constraint firstItem="k9z-2G-Fhx" firstAttribute="trailing" secondItem="9O4-jf-dgu" secondAttribute="trailing" id="JtI-9e-igF"/> | ||
826 | - <constraint firstItem="EEs-Ae-t7U" firstAttribute="leading" secondItem="9O4-jf-dgu" secondAttribute="leading" id="MzB-kU-gbs"/> | ||
827 | - <constraint firstItem="EEs-Ae-t7U" firstAttribute="trailing" secondItem="9O4-jf-dgu" secondAttribute="trailing" id="NPL-F1-7Sg"/> | ||
828 | - <constraint firstItem="k9z-2G-Fhx" firstAttribute="leading" secondItem="9O4-jf-dgu" secondAttribute="leading" id="QZG-IF-A8F"/> | ||
829 | - <constraint firstItem="EEs-Ae-t7U" firstAttribute="top" secondItem="k9z-2G-Fhx" secondAttribute="bottom" constant="5" id="SBe-2c-H4J"/> | ||
830 | - <constraint firstItem="k9z-2G-Fhx" firstAttribute="top" secondItem="9O4-jf-dgu" secondAttribute="top" id="UIi-qU-PBc"/> | 762 | + <constraint firstItem="EEs-Ae-t7U" firstAttribute="trailing" secondItem="9O4-jf-dgu" secondAttribute="trailing" id="FAp-nP-mMp"/> |
763 | + <constraint firstItem="EEs-Ae-t7U" firstAttribute="top" secondItem="9O4-jf-dgu" secondAttribute="top" constant="70" id="PgN-se-eVb"/> | ||
764 | + <constraint firstItem="EEs-Ae-t7U" firstAttribute="bottom" secondItem="9O4-jf-dgu" secondAttribute="bottom" id="WUH-77-LAa"/> | ||
765 | + <constraint firstItem="EEs-Ae-t7U" firstAttribute="leading" secondItem="9O4-jf-dgu" secondAttribute="leading" id="e5Q-L0-iai"/> | ||
831 | </constraints> | 766 | </constraints> |
832 | <viewLayoutGuide key="safeArea" id="9O4-jf-dgu"/> | 767 | <viewLayoutGuide key="safeArea" id="9O4-jf-dgu"/> |
833 | </view> | 768 | </view> |
834 | <navigationItem key="navigationItem" id="dVv-mJ-714"/> | 769 | <navigationItem key="navigationItem" id="dVv-mJ-714"/> |
835 | <connections> | 770 | <connections> |
836 | - <outlet property="dateViewHeight" destination="38f-Kq-3QN" id="gGs-d3-CD2"/> | ||
837 | <outlet property="reportTable" destination="EEs-Ae-t7U" id="WCp-ci-zOE"/> | 771 | <outlet property="reportTable" destination="EEs-Ae-t7U" id="WCp-ci-zOE"/> |
838 | </connections> | 772 | </connections> |
839 | </viewController> | 773 | </viewController> |