Skip to content
This repository has been archived by the owner on Jun 17, 2018. It is now read-only.

Commit

Permalink
Merge pull request #320 from kitasuke/fix_didScrollEnd_event
Browse files Browse the repository at this point in the history
Fix didScrollEnd event
  • Loading branch information
kitasuke authored Jan 9, 2017
2 parents a0ef2e9 + 8f1a786 commit ba11e66
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Example/PagingMenuControllerDemo2/RootViewControoler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class RootViewControoler: UIViewController {
case let .didMoveItem(menuItemView, previousMenuItemView):
print(previousMenuItemView)
print(menuItemView)
case .didScrollStart:
print("Scroll start")
case .didScrollEnd:
print("Scroll end")
}
}

Expand Down
8 changes: 3 additions & 5 deletions Pod/Classes/PagingMenuController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ open class PagingMenuController: UIViewController {

extension PagingMenuController: UIScrollViewDelegate {
public func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
onMove?(.didScrollEnd)

let nextPage: Int
switch (scrollView, pagingViewController, menuView) {
case let (scrollView, pagingViewController?, _) where scrollView.isEqual(pagingViewController.contentScrollView):
Expand All @@ -327,11 +329,7 @@ extension PagingMenuController: UIScrollViewDelegate {
public func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
onMove?(.didScrollStart)
}

public func scrollViewDidEndDecelerating(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
onMove?(.didScrollEnd)
}


public func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
switch (scrollView, decelerate) {
case (let scrollView, false) where scrollView.isEqual(menuView): break
Expand Down

0 comments on commit ba11e66

Please sign in to comment.