Commit 1ad8d9460b12117ebfc2f6b4587c68b5f1e6fe56
1 parent
e39c2d33
Exists in
parentassistant
commit
Showing
6 changed files
with
23 additions
and
39 deletions
Show diff stats
ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
ParentAssistant/ParentAssistant/Classes/controllers/Grow/GrowViewController.swift
| @@ -99,7 +99,7 @@ class GrowViewController: UIViewController,UIScrollViewDelegate { | @@ -99,7 +99,7 @@ class GrowViewController: UIViewController,UIScrollViewDelegate { | ||
| 99 | } | 99 | } |
| 100 | //设置scrollview滑动范围 | 100 | //设置scrollview滑动范围 |
| 101 | contentScrollView.contentSize = CGSize.init(width: width*CGFloat(titleArr.count), height: 0) | 101 | contentScrollView.contentSize = CGSize.init(width: width*CGFloat(titleArr.count), height: 0) |
| 102 | - contentScrollView.setContentOffset(CGPoint.init(x: 0, y: 0), animated: true) | 102 | +// contentScrollView.setContentOffset(CGPoint.init(x: 0, y: 0), animated: true) |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | override func viewWillAppear(_ animated: Bool) { | 105 | override func viewWillAppear(_ animated: Bool) { |
ParentAssistant/ParentAssistant/Classes/controllers/Grow/Report/ReportViewController.swift
| @@ -64,34 +64,15 @@ class ReportViewController: UIViewController,UITableViewDelegate,UITableViewData | @@ -64,34 +64,15 @@ class ReportViewController: UIViewController,UITableViewDelegate,UITableViewData | ||
| 64 | recognizer.direction = UISwipeGestureRecognizerDirection.down | 64 | recognizer.direction = UISwipeGestureRecognizerDirection.down |
| 65 | headView.addGestureRecognizer(recognizer) | 65 | headView.addGestureRecognizer(recognizer) |
| 66 | 66 | ||
| 67 | - calendar = CalendarView.init(frame: CGRect.init(x: 0, y: y, width: screenWidth, height: 245)) | 67 | + calendar = CalendarView.init(frame: CGRect.init(x: 0, y: y*2, width: screenWidth, height: 245)) |
| 68 | 68 | ||
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | @objc func showView(){ | 71 | @objc func showView(){ |
| 72 | 72 | ||
| 73 | calendar.showView() | 73 | calendar.showView() |
| 74 | -// keyWindow = UIApplication.shared.keyWindow! | ||
| 75 | -// let backBtn = UIButton.init(frame: CGRect.init(x: 0, y: calendar.frame.origin.y+245+y, width: screenWidth, height: screenHeight)) | ||
| 76 | -// backBtn.backgroundColor = UIColor.black | ||
| 77 | -// backBtn.alpha = 0.4 | ||
| 78 | -// | ||
| 79 | -// backBtn.addTarget(self, action: #selector(closeView(btn:)), for: UIControlEvents.allEvents) | ||
| 80 | -// reportTable.isUserInteractionEnabled = false | ||
| 81 | -// | ||
| 82 | -// keyWindow.addSubview(backBtn) | ||
| 83 | -// keyWindow.addSubview(calendar) | ||
| 84 | -// calendar.isHidden = false | ||
| 85 | 74 | ||
| 86 | } | 75 | } |
| 87 | -// @objc func closeView(btn:UIButton) { | ||
| 88 | -// | ||
| 89 | -// reportTable.isUserInteractionEnabled = true | ||
| 90 | -// UIView.animate(withDuration: 0.3) { | ||
| 91 | -// btn.removeFromSuperview() | ||
| 92 | -// self.calendar.isHidden = true | ||
| 93 | -// } | ||
| 94 | -// } | ||
| 95 | override func didReceiveMemoryWarning() { | 76 | override func didReceiveMemoryWarning() { |
| 96 | super.didReceiveMemoryWarning() | 77 | super.didReceiveMemoryWarning() |
| 97 | } | 78 | } |
ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/CalendarView.swift
| @@ -12,7 +12,7 @@ class CalendarView: UIView,UICollectionViewDelegate,UICollectionViewDataSource { | @@ -12,7 +12,7 @@ class CalendarView: UIView,UICollectionViewDelegate,UICollectionViewDataSource { | ||
| 12 | 12 | ||
| 13 | var keyWindow = UIWindow() | 13 | var keyWindow = UIWindow() |
| 14 | var backBtn = UIButton() | 14 | var backBtn = UIButton() |
| 15 | - | 15 | + var topBtn = UIButton() |
| 16 | var weekLab = ["日","一","二","三","四","五","六"] | 16 | var weekLab = ["日","一","二","三","四","五","六"] |
| 17 | var firstDay = Int() | 17 | var firstDay = Int() |
| 18 | var monthDay = Int() | 18 | var monthDay = Int() |
| @@ -20,14 +20,13 @@ class CalendarView: UIView,UICollectionViewDelegate,UICollectionViewDataSource { | @@ -20,14 +20,13 @@ class CalendarView: UIView,UICollectionViewDelegate,UICollectionViewDataSource { | ||
| 20 | 20 | ||
| 21 | override init(frame: CGRect) { | 21 | override init(frame: CGRect) { |
| 22 | super.init(frame: frame) | 22 | super.init(frame: frame) |
| 23 | - self.addSubview(self.collectionView) | ||
| 24 | - collectionView.snp.makeConstraints { (maker) in | ||
| 25 | - maker.center.equalToSuperview() | ||
| 26 | - maker.height.width.equalToSuperview() | 23 | + if !frame.isEmpty{ |
| 24 | + self.addSubview(self.collectionView) | ||
| 25 | + firstDay = CalendarDateManager.shared.getFirstMonthDays() | ||
| 26 | + monthDay = CalendarDateManager.shared.getCurrentMonthDay() | ||
| 27 | + todayDay = CalendarDateManager.shared.getTodayDate() | ||
| 27 | } | 28 | } |
| 28 | - self.isHidden = false | ||
| 29 | } | 29 | } |
| 30 | - | ||
| 31 | override func layoutSubviews() { | 30 | override func layoutSubviews() { |
| 32 | 31 | ||
| 33 | self.flowlayOut.itemSize = CGSize.init(width: self.bounds.size.width/7, height: 35) | 32 | self.flowlayOut.itemSize = CGSize.init(width: self.bounds.size.width/7, height: 35) |
| @@ -35,7 +34,7 @@ class CalendarView: UIView,UICollectionViewDelegate,UICollectionViewDataSource { | @@ -35,7 +34,7 @@ class CalendarView: UIView,UICollectionViewDelegate,UICollectionViewDataSource { | ||
| 35 | lazy var flowlayOut = {()-> UICollectionViewFlowLayout in | 34 | lazy var flowlayOut = {()-> UICollectionViewFlowLayout in |
| 36 | //设置layout | 35 | //设置layout |
| 37 | let flowlayout = UICollectionViewFlowLayout() | 36 | let flowlayout = UICollectionViewFlowLayout() |
| 38 | - flowlayout.itemSize = CGSize.init(width: screenWidth/7, height:35) | 37 | + flowlayout.itemSize = CGSize.init(width: self.bounds.size.width/7, height:35) |
| 39 | flowlayout.minimumLineSpacing = 0 | 38 | flowlayout.minimumLineSpacing = 0 |
| 40 | flowlayout.minimumInteritemSpacing = 0 | 39 | flowlayout.minimumInteritemSpacing = 0 |
| 41 | flowlayout.headerReferenceSize = CGSize.init(width: 0, height: 0) | 40 | flowlayout.headerReferenceSize = CGSize.init(width: 0, height: 0) |
| @@ -46,7 +45,7 @@ class CalendarView: UIView,UICollectionViewDelegate,UICollectionViewDataSource { | @@ -46,7 +45,7 @@ class CalendarView: UIView,UICollectionViewDelegate,UICollectionViewDataSource { | ||
| 46 | 45 | ||
| 47 | lazy var collectionView = {()-> UICollectionView in | 46 | lazy var collectionView = {()-> UICollectionView in |
| 48 | 47 | ||
| 49 | - let calendarView = UICollectionView.init(frame: frame, collectionViewLayout: flowlayOut) | 48 | + let calendarView = UICollectionView.init(frame: self.bounds, collectionViewLayout: flowlayOut) |
| 50 | calendarView.delegate = self | 49 | calendarView.delegate = self |
| 51 | calendarView.dataSource = self | 50 | calendarView.dataSource = self |
| 52 | calendarView.backgroundColor = UIColor.white | 51 | calendarView.backgroundColor = UIColor.white |
| @@ -59,27 +58,32 @@ class CalendarView: UIView,UICollectionViewDelegate,UICollectionViewDataSource { | @@ -59,27 +58,32 @@ class CalendarView: UIView,UICollectionViewDelegate,UICollectionViewDataSource { | ||
| 59 | func showView(){ | 58 | func showView(){ |
| 60 | 59 | ||
| 61 | let key = UIApplication.shared.keyWindow! | 60 | let key = UIApplication.shared.keyWindow! |
| 61 | + | ||
| 62 | + let top = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: self.bounds.size.width, height: self.frame.origin.y)) | ||
| 63 | + top.backgroundColor = UIColor.clear | ||
| 64 | + top.addTarget(self, action: #selector(closeView(btn:)), for: UIControlEvents.allEvents) | ||
| 65 | + | ||
| 62 | let back = UIButton.init(frame: CGRect.init(x: 0, y: self.bounds.size.height, width: screenWidth, height: screenHeight)) | 66 | let back = UIButton.init(frame: CGRect.init(x: 0, y: self.bounds.size.height, width: screenWidth, height: screenHeight)) |
| 63 | back.backgroundColor = UIColor.black | 67 | back.backgroundColor = UIColor.black |
| 64 | back.alpha = 0.4 | 68 | back.alpha = 0.4 |
| 65 | - | ||
| 66 | back.addTarget(self, action: #selector(closeView(btn:)), for: UIControlEvents.allEvents) | 69 | back.addTarget(self, action: #selector(closeView(btn:)), for: UIControlEvents.allEvents) |
| 67 | 70 | ||
| 71 | + key.addSubview(top) | ||
| 68 | key.addSubview(back) | 72 | key.addSubview(back) |
| 69 | key.addSubview(self) | 73 | key.addSubview(self) |
| 74 | + | ||
| 70 | self.isHidden = false | 75 | self.isHidden = false |
| 71 | keyWindow = key | 76 | keyWindow = key |
| 72 | backBtn = back | 77 | backBtn = back |
| 73 | - self.snp.makeConstraints { (maker) in | ||
| 74 | - maker.center.equalTo(self) | ||
| 75 | - maker.height.width.equalTo(self) | ||
| 76 | - } | 78 | + topBtn = top |
| 79 | + | ||
| 77 | } | 80 | } |
| 78 | //MARK: - 关闭视图 | 81 | //MARK: - 关闭视图 |
| 79 | @objc func closeView(btn:UIButton) { | 82 | @objc func closeView(btn:UIButton) { |
| 80 | 83 | ||
| 81 | UIView.animate(withDuration: 0.3) { | 84 | UIView.animate(withDuration: 0.3) { |
| 82 | self.backBtn.removeFromSuperview() | 85 | self.backBtn.removeFromSuperview() |
| 86 | + self.topBtn.removeFromSuperview() | ||
| 83 | self.keyWindow = UIWindow.init() | 87 | self.keyWindow = UIWindow.init() |
| 84 | self.isHidden = true | 88 | self.isHidden = true |
| 85 | } | 89 | } |
ParentAssistant/ParentAssistant/Classes/controllers/Information/Controller/InformationViewController.swift
| @@ -46,7 +46,7 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | @@ -46,7 +46,7 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | ||
| 46 | self.navigationItem.backBarButtonItem = item | 46 | self.navigationItem.backBarButtonItem = item |
| 47 | 47 | ||
| 48 | drawTopUI() | 48 | drawTopUI() |
| 49 | - | 49 | + self.getDataFromNet() |
| 50 | } | 50 | } |
| 51 | override func viewWillAppear(_ animated: Bool) { | 51 | override func viewWillAppear(_ animated: Bool) { |
| 52 | super.viewWillAppear(animated) | 52 | super.viewWillAppear(animated) |
| @@ -62,7 +62,6 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | @@ -62,7 +62,6 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | ||
| 62 | } | 62 | } |
| 63 | } | 63 | } |
| 64 | } | 64 | } |
| 65 | - self.getDataFromNet() | ||
| 66 | } | 65 | } |
| 67 | func drawTopUI(){ | 66 | func drawTopUI(){ |
| 68 | 67 |
ParentAssistant/ParentAssistant/Supporting Files/Info.plist
| @@ -43,11 +43,11 @@ | @@ -43,11 +43,11 @@ | ||
| 43 | <array> | 43 | <array> |
| 44 | <string>armv7</string> | 44 | <string>armv7</string> |
| 45 | </array> | 45 | </array> |
| 46 | + <key>UIStatusBarStyle</key> | ||
| 47 | + <string>UIStatusBarStyleLightContent</string> | ||
| 46 | <key>UISupportedInterfaceOrientations</key> | 48 | <key>UISupportedInterfaceOrientations</key> |
| 47 | <array> | 49 | <array> |
| 48 | <string>UIInterfaceOrientationPortrait</string> | 50 | <string>UIInterfaceOrientationPortrait</string> |
| 49 | - <string>UIInterfaceOrientationLandscapeLeft</string> | ||
| 50 | - <string>UIInterfaceOrientationLandscapeRight</string> | ||
| 51 | </array> | 51 | </array> |
| 52 | <key>UISupportedInterfaceOrientations~ipad</key> | 52 | <key>UISupportedInterfaceOrientations~ipad</key> |
| 53 | <array> | 53 | <array> |