Skip to content

Commit

Permalink
Unlock a scroll view when untracked
Browse files Browse the repository at this point in the history
  • Loading branch information
scenee committed Dec 4, 2021
1 parent 5851fd7 commit e39f634
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Sources/Core.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ class Core: NSObject, UIGestureRecognizerDelegate {
didSet {
oldValue?.panGestureRecognizer.removeTarget(self, action: nil)
scrollView?.panGestureRecognizer.addTarget(self, action: #selector(handle(panGesture:)))
if let cur = scrollView {
if oldValue == nil {
initialScrollOffset = cur.contentOffset
scrollBounce = cur.bounces
scrollIndictorVisible = cur.showsVerticalScrollIndicator
}
} else {
if let pre = oldValue {
pre.isDirectionalLockEnabled = false
pre.bounces = scrollBounce
pre.showsVerticalScrollIndicator = scrollIndictorVisible
}
}
}
}

Expand Down

0 comments on commit e39f634

Please sign in to comment.