Start a Project

Table View Stretch Header / Parallax animation in Swift

We can use a stretching header in our application. It becomes easier to create because by default iOS gives you the bouncy backs to table views and scroll views.

Follow the steps to create the stretcher header or we can say that parallax animation on the table view header:-

Create the object of your header View and initialize header view xib from the bundle.

Set table view estimation row height and assign header view to the table header view.

Remove the header from the table header view and also set the table view contentInset according to the size you need of the header

Manage y origin of a header according to when the user scrolls the table view.

You can also add the blur effect to the header of the table view

You can call this method in view of did load of the controller. So you have successfully added a stretchy header in your app.

Thanks for going through this blog. Stay cool and stay updated.

Exit mobile version