Keep subview in Scroll View always on screen

Demo:

keep-subview-in-scrollView-always-on-screen-image
  • contentOffset is 0 if the scrollView is scrolled top

  • contentOffset of a scrollView will increase as user scroll down

To keep the overlayView on the same position on screen, just increase the posY of the frame of the overlayView as the contentOffset increase

Last updated

Was this helpful?