There are many open source implementations of this, such as:
- https://github.com/apping/APParallaxHeader
- https://github.com/modocache/MDCParallaxView
- https://github.com/quemb/QMBParallaxScrollViewController
The basic idea behind these is to have an imageview as a subview of the scrollview. When scrolling, you monitor the content offset of the scrollview, and when you reach a certain threshold, you start increasing the image view's height. If you set the image view's contentMode
to UIViewContentModeScaleAspectFill
, you will get the effect you want.