Skip to content

Instantly share code, notes, and snippets.

@hsleedevelop
Created November 29, 2018 04:06
Show Gist options
  • Save hsleedevelop/eed79a3297b615abead64113a950e846 to your computer and use it in GitHub Desktop.
Save hsleedevelop/eed79a3297b615abead64113a950e846 to your computer and use it in GitHub Desktop.
scrollViewWillEndDragging
func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
guard self.topSectionViewTopConstraint.constant > 0 else { return }
let tableViewOffset = tableViewTopEdgeInset + scrollView.contentOffset.y
let topSectionViewTop = tableViewTopEdgeInset - listHeaderView.dimViewHeight
//-160 ~ 0
var offset = (topSectionViewTop - tableViewOffset)
offset = offset > topSectionViewTop / 2.c ? -tableViewTopEdgeInset : -listHeaderView.dimViewHeight.c
targetContentOffset.pointee.y = offset
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment