Skip to content

Major Release: Redesign Pagination Effect For JZCalendarWeekView

Latest
Compare
Choose a tag to compare
@zjfjack zjfjack released this 26 May 06:55
· 18 commits to master since this release
5192f1f

The goal of this v0.7.0 release is to redesign JZCalendarWeekView scroll pagination effect.

This issue is actually caused by using setContentOffset method to do pagination effect. The scenario is when users swiped view(willEndDragging called) then they swipe again or touch screen. The result might be

  • Flickering view issue #40 #46 #51
  • view stopped at the touch position(wrong position). For further touch screen description, you can refer to this StackOverflow question which is asked and answered by myself.

In order to redesign the pagination effect, I have to change setContentOffset method to settargetContentOffset and the property initialContentOffset set in willBeginDragging should be deleted because it shouldn't be considered. I don't care where it started, I only care where it should scroll to with the current state. Also, scrollSections for sectionScroll type has been deleted too.

In order to achieve this goal, some methods are refactored and fixed as well.

  1. 3f976fb getDateForX, getDateForY and getDateForPoint are quite confused and misused in the past because the calculation method for gesture point x in UICollectionView is different from UICollectionView contentOffset x. As a result, those methods are refactored to 6 different methods, which are
    getDateForContentOffsetX, getDateForContentOffsetY, getDateForContentOffset (For contentOffset)
    getDateForPointX, getDateForPointY, getDateForPoint (For gesture point)

  2. f027db9 ScrollDirection has been redesigned, the previous solution is actually implemented by WRCalendarView, which cannot get actual direction sometimes and it highly depends on the property initialContentOffset which we want to delete.

Unfortunately, two small issues are also introduced in this new pagination effect.

  1. Even though I set the deceleratingRate to fast, the last few milliseconds of scrolling animation are still very slow, which is not as fast as setContentOffset.

  2. Because of the first issue, it will take more time to scroll to the required targetContentOffset, if you scroll again at the same time, it won't work. It means you cannot scroll very fast to the third page only if the last animation finished and view reloaded.

If you have any good suggestions for the deceleratingRate issue, let me know.

One more issue fixed out of this goal is
af9fc0a Fixed cell rendering issue #54 by replacing overlap calculation method