diff --git a/Example/JZCalendarWeekViewExample/Supporting Files/Info.plist b/Example/JZCalendarWeekViewExample/Supporting Files/Info.plist index 025ea6a..82fa3c1 100644 --- a/Example/JZCalendarWeekViewExample/Supporting Files/Info.plist +++ b/Example/JZCalendarWeekViewExample/Supporting Files/Info.plist @@ -15,9 +15,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.5.5 + 0.5.6 CFBundleVersion - 18110801 + 18121201 LSRequiresIPhoneOS UILaunchStoryboardName diff --git a/JZCalendarWeekView.podspec b/JZCalendarWeekView.podspec index c09672f..b29eb8a 100644 --- a/JZCalendarWeekView.podspec +++ b/JZCalendarWeekView.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "JZCalendarWeekView" - s.version = "0.5.5" + s.version = "0.5.6" s.summary = "Calendar Week & Day View in iOS Swift" s.homepage = "https://github.com/zjfjack/JZCalendarWeekView" s.license = { :type => "MIT", :file => "LICENSE" } diff --git a/JZCalendarWeekView/Info.plist b/JZCalendarWeekView/Info.plist index 738f135..b55c527 100644 --- a/JZCalendarWeekView/Info.plist +++ b/JZCalendarWeekView/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.5.5 + 0.5.6 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/JZCalendarWeekView/JZBaseWeekView.swift b/JZCalendarWeekView/JZBaseWeekView.swift index 2c6761c..a09c161 100644 --- a/JZCalendarWeekView/JZBaseWeekView.swift +++ b/JZCalendarWeekView/JZBaseWeekView.swift @@ -186,7 +186,7 @@ open class JZBaseWeekView: UIView { } open func updateAllDayBar(isScrolling: Bool) { - guard isAllDaySupported && !isScrolling else { return } + guard isAllDaySupported else { return } var maxEventsCount: Int = 0 getDatesInCurrentPage(isScrolling: isScrolling).forEach { let count = allDayEventsBySection[$0]?.count ?? 0 @@ -196,7 +196,10 @@ open class JZBaseWeekView: UIView { } let newAllDayHeader = flowLayout.defaultAllDayOneLineHeight * CGFloat(min(maxEventsCount, 2)) if newAllDayHeader != flowLayout.allDayHeaderHeight { - flowLayout.allDayHeaderHeight = newAllDayHeader + // Check whether we need update the allDayHeaderHeight + if !isScrolling || !willEffectContentSize(difference: flowLayout.allDayHeaderHeight - newAllDayHeader) { + flowLayout.allDayHeaderHeight = newAllDayHeader + } } } @@ -224,6 +227,13 @@ open class JZBaseWeekView: UIView { collectionView.reloadData() } + /// Notice: A temporary solution to fix the scroll from bottom issue when isScrolling + /// The issue is because the decreased height value will cause the system to change the collectionView contentOffset, but the affected contentOffset will + /// greater than the contentSize height, and the view will show some abnormal updates, this value will be used with isScrolling to check whether the in scroling change will be applied + private func willEffectContentSize(difference: CGFloat) -> Bool { + return collectionView.contentOffset.y + difference + collectionView.bounds.height > collectionView.contentSize.height + } + /// Fix collectionView scroll from bottom (contentsize height decreased) wrong offset issue private func getYOffset() -> CGFloat { guard isAllDaySupported else { return collectionView.contentOffset.y }