Open onmyway133 opened 8 years ago
I tried putting a heightConstraint on the imageView, and try activate, deactivate those 3 constraints (heightConstraint, C1, C2) but it crashes
func scrollViewDidScroll(scrollView: UIScrollView) {
let sketchy = scrollView.contentOffset.y <= 0
heightConstraint.active = !sketchy
c1.active = sketchy
c2.active = sketchy
}
Thanks for the code, you explain better than the original blog :D
With the current implementation, the imageView always pins to the top. Now we have 2 top constraints from the imageView to the TopLayoutGuide (1 with equal, priority 999 and 1 with less than, priority 1000), let call them C1 and C2
This would make it scroll with the scrollView as well