Skip to content

Commit

Permalink
[ASCalendar][bugfix] Fix settings changing bug in runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberto Scampini authored and Alberto Scampini committed Jun 5, 2016
1 parent 6d938a6 commit a9b8949
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file not shown.
27 changes: 21 additions & 6 deletions Example/Calendar/ASBodyV.swift
Expand Up @@ -27,16 +27,25 @@ ASCalendarNamesM {
self.viewModel?.settingsM.selectedMonth.bindAndFire{
[unowned self] in
_ = $0
self.reloadCell(0)
self.reloadCell(1)
self.reloadCell(2)
self.reloadData()
}

self.viewModel?.settingsM.startByMonday.bindAndFire{
[unowned self] in
_ = $0
self.reloadData()
}

self.viewModel?.settingsM.selectionStyle.bindAndFire{
[unowned self] in
_ = $0
self.reloadData()
}

self.viewModel?.settingsM.selectedDay.bind {
[unowned self] in
_ = $0
self.reloadCell(0)
self.reloadCell(1)
self.reloadCell(2)
self.reloadData()
}
self.viewModel?.settingsM.startByMonday.bindAndFire {
[unowned self] in
Expand Down Expand Up @@ -155,4 +164,10 @@ ASCalendarNamesM {
self.scrollView.contentSize = CGSize(width: width, height: height * 3)
}

func reloadData() {
self.reloadCell(0)
self.reloadCell(1)
self.reloadCell(2)
}

}
1 change: 0 additions & 1 deletion Example/ViewController.swift
Expand Up @@ -23,7 +23,6 @@ class ViewController: UIViewController, ASCalendarDelegate {
@IBAction func openDefault(sender : UIButton) {
let calendar = ASCalendar()
calendar.delegate = self
calendar.setMondayFirstWeekDay(true)
calendar.showCalendarAsLayer()
}

Expand Down

0 comments on commit a9b8949

Please sign in to comment.