| | |
| | | private var limitDay = 1 |
| | | private var quarter:Int! |
| | | private var week:Int! |
| | | private var studyScheduleModel:StudyScheduleModel! |
| | | |
| | | private lazy var menu:SPPageMenu = { |
| | | let menu = SPPageMenu(frame: .zero, trackerStyle: .line) |
| | |
| | | return vc |
| | | }() |
| | | |
| | | required init(quarter:Int,week:Int) { |
| | | required init(quarter:Int,week:Int,studyScheduleModel:StudyScheduleModel) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.quarter = quarter |
| | | self.week = week |
| | | self.studyScheduleModel = studyScheduleModel |
| | | } |
| | | |
| | | required init?(coder: NSCoder) { |
| | | fatalError("init(coder:) has not been implemented") |
| | | } |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | |
| | | Services.studySchedule(week: week).subscribe(onNext: {data in |
| | | self.limitDay = data.data?.day ?? 0 |
| | | self.limitDay = studyScheduleModel.day |
| | | |
| | | #if DEBUG |
| | | self.limitDay = 5 |
| | | #endif |
| | | #if DEBUG |
| | | self.limitDay = 5 |
| | | #endif |
| | | |
| | | if self.limitDay == 5{ |
| | | self.limitDay = Int.max |
| | | if self.limitDay == 5{ |
| | | self.limitDay = Int.max |
| | | } |
| | | |
| | | for (index,titleL) in (self.menu.subviews.last?.subviews[1].subviews ?? []).filter({$0 is UIButton}).enumerated(){ |
| | | if let btn = titleL as? UIButton{ |
| | | btn.setTitleColor(index < (self.limitDay) ? .black:.black.withAlphaComponent(0.33), for: .normal) |
| | | self.menu.setEnabled(index < (self.limitDay), forItemAt: UInt(index)) |
| | | } |
| | | |
| | | for (index,titleL) in (self.menu.subviews.last?.subviews[1].subviews ?? []).filter({$0 is UIButton}).enumerated(){ |
| | | if let btn = titleL as? UIButton{ |
| | | btn.setTitleColor(index < (self.limitDay) ? .black:.black.withAlphaComponent(0.33), for: .normal) |
| | | self.menu.setEnabled(index < (self.limitDay), forItemAt: UInt(index)) |
| | | } |
| | | } |
| | | self.pageVC.reloadData() |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |
| | | self.pageVC.reloadData() |
| | | } |
| | | |
| | | override func setUI() { |
| | | super.setUI() |