Skip to content

Commit

Permalink
20220117_5 didScrollCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
qubyedev committed Jan 16, 2022
1 parent fe6acfb commit 568923b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ class CustomCalendarExampleController: DayViewController {
navigationController?.navigationBar.isTranslucent = false
dayView.autoScrollToFirstEvent = true
reloadData()
// dayView.dayHeaderView.didScrollPageCallback = { date in
// print("5566 date: \(date)")
// }
}

// MARK: EventDataSource
Expand Down
2 changes: 2 additions & 0 deletions Sources/Header/DayHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import UIKit
public final class DayHeaderView: UIView, DaySelectorDelegate, DayViewStateUpdating, UIPageViewControllerDataSource, UIPageViewControllerDelegate {
public private(set) var daysInWeek = 7
public let calendar: Calendar
public var didScrollPageCallback:(_ date:Date) -> () = {_ in}

private var style = DayHeaderStyle()
private var currentSizeClass = UIUserInterfaceSizeClass.compact
Expand Down Expand Up @@ -191,6 +192,7 @@ public final class DayHeaderView: UIView, DaySelectorDelegate, DayViewStateUpdat
selector.selectedIndex = currentWeekdayIndex
if let selectedDate = selector.selectedDate {
state?.client(client: self, didMoveTo: selectedDate)
self.didScrollPageCallback(selectedDate)
}
}
// Deselect all the views but the currently visible one
Expand Down
4 changes: 2 additions & 2 deletions Sources/Header/DaySelector/DaySelector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ public final class DaySelector: UIView {
x = parentWidth - x - size.width
}

print("test 0114 size: \(size)")
// print("test 0114 size: \(size)")

let origin = CGPoint(x: x,
y: 0)
let frame = CGRect(origin: origin,
size: newSize)

print("test 0114 frame: \(frame)")
// print("test 0114 frame: \(frame)")
item.frame = frame
}
}
Expand Down

0 comments on commit 568923b

Please sign in to comment.