Skip to content

Instantly share code, notes, and snippets.

@Anik0808
Last active September 24, 2022 19:48
Show Gist options
  • Save Anik0808/40727a2fa04efb2348f7606f778f1991 to your computer and use it in GitHub Desktop.
Save Anik0808/40727a2fa04efb2348f7606f778f1991 to your computer and use it in GitHub Desktop.
func scrollViewDidScroll(_ scrollView: UIScrollView) {
// get the content offset for y-axis
let contentOffsetheight = scrollView.contentOffset.y
//if the value is negative
if contentOffsetheight < 0 {
//change the anchors
contentViewTopAnchor.constant = contentOffsetheight
headerViewHeightAnchor.constant = 450 + (-contentOffsetheight)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment